on 05-11-2005 12:09 AM
Hi,
I am running into a scnerio in which the Xpath condition in Switch Condition does not take effect correctly.
Basically I want if there is more than 1 Header items then go to branch 1 ELSE go to branch 2.
Xpath: (RFC_Response./p1:ZOTCI002_RFC_CAPITAL_RETURNS.Response/I_ZOTC_ORDER_HEADER/item[2] EX
But I get this Message and by default everything goes into my default branch.
"Multiple condition merges in default branch".
But when I try the same xpath in XML Spy for the given xml message it processes correctly so something is wrong with the Condition Editor in BPM.
I have tried the "count" xpath i.e
count(RFC_Response./p1:ZOTCI002_RFC_CAPITAL_RETURNS.Response/I_ZOTC_ORDER_HEADER/item) = 1
and I tried it to check if it is 1 or not but that does not work too.
Can someone tell me what is the problem??
Thanks
Ashish
Hi,
one of the solutions you can try is to create a "dummy" abstract message with one field, then map your ZOTCI002_RFC_CAPITAL_RETURNS to this dummy one (transformation step) with a graphical mapping for instance - something like count all items - dummy-filed1
and then base your switch on the dummy message
we had lots of problems with the switch condition too
Regards,
michal
Message was edited by: Michal Krawczyk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ya, you can't use the count function in XPATH - you can only use the functions given to you (EQ, etc etc). That bottom area is not a true free-form XPATH area.
In your mapping, do a custom user function into a "dummy" field in your layout to store the count... then set that up as a context object & you can use it inside BPM for your branching criteria.
The only other suggestion I have (although this never worked quite as we expected) is to use the XPATH "exists" and try to get it to reference the second line - if it comes back "true" take your branch. We prefered the 1st option, as it's a bit cleaner.
Hi,
you can do a very simple "advanced java function"
with one inbound argument
the source code (let's name it "easyCount"):
String s = String.valueOf(a.length);
result.addValue(s);
now in the mapping for the filed in the dummy interface
should look like this:
ZOTCI002_RFC_CAPITAL_RETURNS.Response/I_ZOTC_ORDER_HEADER/item -> removeContext(function from the Node functions) -> easyCount -> dummnyfiled
check it now the dummy field has the number of the items at least it should and now you can base your switch on this dummy field
Regards,
michal
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.