Author |
Message
|
kt76 |
Posted: Mon Jan 19, 2004 10:57 pm Post subject: route using filter node |
|
|
Acolyte
Joined: 18 Jan 2004 Posts: 52
|
Hi,
Our requirement is that depending on a field value we route to diff flows.
Our xml looks something like this:
<root>
<aaa xxx="3" type="string"></aaa>
</root>
<aaa> is a user defined type. Though it takes string values, the message set created through the dtd makes it of anonymous type in message broker.
If <aaa xxx="3" type="string"></aaa> then goto flow1 (out terminal True)
and if <aaa xxx="3" type="string">some value</aaa> goto flow2( out terminal false)
We are trying using Filter nodes.
The ESQL code snippent we wrote is:
IF Body.aaa IS NULL THEN
RETURN TRUE;
ELSE
RETURN FALSE;
It either always goes to the True out terminal.
Could you help us with our case. |
|
Back to top |
|
 |
vmcgloin |
Posted: Tue Jan 20, 2004 1:07 am Post subject: |
|
|
Knight
Joined: 04 Apr 2002 Posts: 560 Location: Scotland
|
Are you sure you are qualifying the field correctly? For the example you give should it be Body.root.aaa?
Send te message to a trace node, tracing {$Root} to check that the structure matches what you think it is.
Cheers,
Vicky |
|
Back to top |
|
 |
kt76 |
Posted: Tue Jan 20, 2004 4:10 am Post subject: getting value of a tag of complex type |
|
|
Acolyte
Joined: 18 Jan 2004 Posts: 52
|
Our xml looks like:
<aaa att1="3" att2="string">
</aaa>
The dtd generated for this, creates a MesgDefFile with a mesg containing elements of complex type ="Anonymous".
like
aaa = Anonymous(complex type)
|--- att1 =local attribute
|--- att2 =local attribute
How do we extract the value of <aaa> using the compute node.
All are computation is failing b'coz we are unable to extract the value, |
|
Back to top |
|
 |
wooda |
Posted: Tue Jan 20, 2004 4:27 am Post subject: |
|
|
 Master
Joined: 21 Nov 2003 Posts: 265 Location: UK
|
Are you using MRM or XML domain? You mention message sets so I assume it's the MRM domain.
If it's the MRM domain then Body.aaa is correct.
Also what is interpreted as null depends on the settings in the XML wire format level of the message set.
A missing element will always be considered NULL and with default settings in the message set empty tags will also be considered NULL.
IF it's XML domain then Body.root.aaa should be used. (as vcmgloin said.)
In the XML domain the only way "IF Body.aaa IS NULL ..." will resolve to TRUE is if the field is missing. XML domain has no concept of explicit NULLs. So <aaa></aaa> will never resolve to NULL if it's been parsed correctly and is present in the message.
However the fact that <aaa>data</aaa> also resolves to NULL tells us that the field is not being found by the ESQL. ie. It's missing. Why is it missing? Possibly because you havn't referenced it correctly and possibly because it isn't parsed (make sure the message is input in the correct domain etc.)
By the way if you want to test for <aaa></aaa> in the XML domain you will have to match the value of the field to an empty string.
And if you want to make sure in either XML or MRM domain that a field is NULL and not missing completly then use something like;
IF (CARDINALITY(Body.aaa[]) >= 1 AND InputRoot.XML.message.field1 IS NULL) THEN ....
ie. The field is present but NULL. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jan 20, 2004 6:37 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Also, if you find yourself nesting more than about two Filter Nodes, like
Filter--true-->Filter
--false-->Filter
Then you're better off switching to a RouteToLabel/Label structure - both from a performance and a maintainability standpoint. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
wooda |
Posted: Tue Jan 20, 2004 6:48 am Post subject: |
|
|
 Master
Joined: 21 Nov 2003 Posts: 265 Location: UK
|
Hope the mistake in my example ESQL didn't coinfuse too much.
Should have read;
IF (CARDINALITY(Body.aaa[]) >= 1 AND Body.aaa IS NULL) THEN ....
ie. We are testing that the field aaa is both present and NULL. |
|
Back to top |
|
 |
kt76 |
Posted: Tue Jan 20, 2004 7:20 am Post subject: |
|
|
Acolyte
Joined: 18 Jan 2004 Posts: 52
|
The ESQL you gave still does the same. It always goes to Return True... |
|
Back to top |
|
 |
Missam |
Posted: Tue Jan 20, 2004 11:27 am Post subject: |
|
|
Chevalier
Joined: 16 Oct 2003 Posts: 424
|
Just Use
IF CARDINALITY(Body.aaa[]) >= 1
Then it'll work fine |
|
Back to top |
|
 |
|