Author |
Message
|
venky |
Posted: Sat Aug 30, 2003 2:07 pm Post subject: Filter node and XML messages. |
|
|
 Master
Joined: 08 Jul 2003 Posts: 205
|
How do I access the XML messages in the Filter node ?
For Example, this is my message,
<?xml version="1.0" encoding="UTF-8"?>
<Invoice>
<Purchases>
<Item>
<Quantity>10</Quantity>
</Item>
<Item>
<Quantity>200</Quantity>
</Item>
</Purchases>
</Invoice>
how to I get the value 10 and store it in a INTEGER data type.
Please help me with the proper ESQL to be written in the filter node.
thanks
Venky. |
|
Back to top |
|
 |
EddieA |
Posted: Sat Aug 30, 2003 2:55 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
A filter node is just that. The ability to filter (and change the path of the message) based on the message content. There is no way to change the actual content of the message.
If you want to change the message, then use a Compute node.
What do you want to do when you have stored the value in an INTEGER.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
inder |
Posted: Sat Aug 30, 2003 3:08 pm Post subject: |
|
|
Apprentice
Joined: 24 Mar 2003 Posts: 49 Location: USA
|
You cannot change the contents of a message using the filter node. U can make decisions to route the messages depending on the conditions.
If you want to take the contents of your XML message in to a integer to make some decisions, you can do as below
Declare aa int;
set aa = Root.XML.(XML.tag)Invoice.Purchases.Item[1].Quantity;
As there are no output message to be referenced in the filter node we just reference the input message as Root instead of InputRoot
remember the above code works only if the element(Quantity) is integer . If not it throws an error saying try to cast character as integer. Here I just put 1 for referencing the first element. You can use an index to get to any element.
Hope this helps
Inder |
|
Back to top |
|
 |
venky |
Posted: Tue Sep 02, 2003 8:10 am Post subject: Filter node (Inder and Eddie) |
|
|
 Master
Joined: 08 Jul 2003 Posts: 205
|
Hi Inder and Eddie.
thanks for your suggestion.
Declare aa int;
set aa = Root.XML.(XML.tag)Invoice.Purchases."Item"[1].Quantity;
return aa<20;
aa = 10 (according to my program)
but doesn't go thru.
do you see any mistakes up there.
Venky. |
|
Back to top |
|
 |
Craig B |
Posted: Tue Sep 02, 2003 8:18 am Post subject: |
|
|
Partisan
Joined: 18 Jun 2003 Posts: 316 Location: UK
|
Hi,
When you say 'according to my program aa=10', then does this mean you have verified this with a user trace of the message flow? When you say that the message does not go through, does this mean it does not go through the terminal you expect, or does not go through the True terminal? Do you know what terminal the message does get propagated through? One possibility is that the message is not being represented in the XML domain (Ie you have not put XML in the Input node, or an MQRFH2 header overrides this in some way). This would result in the aa being NULL and therefore NULL < 20 would return unknown and your message would be propagated to the unknown terminal of the filter node.
At this point I would consider taking a user level trace of the flow to see what is being evaluated. Or put a trace node before the filter node and trace ${Root} is ensure the message is as your expect, or wire all the terminals on the filter node to separate outputs, so you can see which terminals your message is propagated through.
Hope this helps. _________________ Regards
Craig |
|
Back to top |
|
 |
|