Author |
Message
|
klabran |
Posted: Thu Jan 20, 2005 9:05 am Post subject: accounting for xml fields not present? |
|
|
 Master
Joined: 19 Feb 2004 Posts: 259 Location: Flagstaff AZ
|
I have a filter node that is constructing an email using the xml data coming into it.
I am using a char to create my body of the email like....
set x = x || 'Tag Name1: ' || xmlincoming.tag1 || NewLineFeed;
set x = x || 'Tag Name2: ' || xmlincoming.tag2 || NewLineFeed;
set mail.body = x;
The xml data has many tags that may not be present and this is blowing up the node.
How can I easily adjust for this?
I thought about wrapping everything
Code: |
if xmlincoming.tag2 is not null then |
but I have enough tags that this is not a desirable approach.
I also thought about perhaps catching the error and spitting out '' for these missing fields in the email. Unfortunately, I'm not sure how to even do this at this point but it sounds good.
What / how would you handle this?
Kevin |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jan 20, 2005 9:12 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I'd use the COALESCE function.
Also, you should not be putting complex logic into filter nodes, and you should not be using a filter node to "construct" data. You will have poor performance.
Use a compute node to perform your logic, and a filter node to check the results. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
klabran |
Posted: Thu Jan 20, 2005 9:17 am Post subject: |
|
|
 Master
Joined: 19 Feb 2004 Posts: 259 Location: Flagstaff AZ
|
Thanks I will take a look at COALESCE. On the filter node I misspoke. The email is being created in a compute node.
Kevin |
|
Back to top |
|
 |
EddieA |
Posted: Thu Jan 20, 2005 10:03 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Quote: |
I have a filter node that is constructing an email using the xml data coming into it. |
That isn't going to work. You cannot change the data, or construct new trees in a Filter.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
kirani |
Posted: Thu Jan 20, 2005 11:41 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
I don't remember this, but can't you update/create Environment Tree in a Filter node? _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Jan 21, 2005 5:43 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
kirani wrote: |
I don't remember this, but can't you update/create Environment Tree in a Filter node? |
I don't remember if that's true either.
But even if it was, I still wouldn't do it. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
JT |
Posted: Fri Jan 21, 2005 8:12 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Quote: |
I don't remember this, but can't you update/create Environment Tree in a Filter node? |
Absolutely you can. |
|
Back to top |
|
 |
kirani |
Posted: Sun Jan 23, 2005 2:46 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
EddieA wrote: |
You cannot change the data, or construct new trees in a Filter.
|
Except Environment tree. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
|