on 03-30-2009 10:38 AM
Hi,
I have this issue in Receiver Determination when I'm making the conditon for the receiver. I have 2 fields in my source that will decide if the message goes through or not. the fields are Site and PartCodeID.
My question is whether I should use "And" or "OR" between the fields when I make the condition. I use "AND" now but it does not work and I get error in sxmb_moni with no receivers found. I am thinking that maybe I should use "OR" somewhere.
(/p1:Envelope/p1:Body/p2:PARTS/Site = 1165
AND /p1:Envelope/p1:Body/p2:PARTS/Site = 4311
AND /p1:Envelope/p1:Body/p2:PARTS/Site = 8384 AND /p1:Envelope/p1:Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = V AND /p1:Envelope/p1:Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = F)
(/p1:Envelope/p1:Body/p2:PARTS/Site = 1165
AND /p1:Envelope/p1:Body/p2:PARTS/Site = 4311
AND /p1:Envelope/p1:Body/p2:PARTS/Site = 8384 AND /p1:Envelope/p1:Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = V AND /p1:Envelope/p1:Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = F)
this condition wont satisfy as one field cannot have more than one value at a time so instead of AND between same fields put or
i.e }(/p1:Envelope/p1:Body/p2:PARTS/Site = 1165
or /p1:Envelope/p1:Body/p2:PARTS/Site = 4311 or /p1:Envelope/p1:Body/p2:PARTS/Site = 8384
AND /p1:Envelope/p1:Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = V or /p1:Envelope/p1:Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = F
you are looking for acondition to be satisfied if Site = 1165 || 4311 || 8384 and PARTCODE = V || F
right?
Rajesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes your assumption is correct, but i wonder if this example works like this that "AND" only is valid for 8384 and V since it is only between them.
(/p1:Envelope/p1:Body/p2:PARTS/Site = 1165
or /p1:Envelope/p1:Body/p2:PARTS/Site = 4311 or /p1:Envelope/p1:Body/p2:PARTS/Site = 8384
AND /p1:Envelope/p1:Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = V or /p1:Envelope/p1:Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = F
Hi, now I have received a message with Site "8374" and PartCodeID "8" which is included in my condition but it still does not work...it says that no receiver was found.
(/p1:Envelope/p1:Body/p2:PARTS/Site = 1622)
OR (/p1:Envelope/p1:Body/p2:PARTS/Site = 1165)
OR (/p1:Envelope/p1:Body/p2:PARTS/Site = 4311)
OR (/p1:Envelope/p1:Body/p2:PARTS/Site = 8374)
OR (/p1:Envelope/p1:Body/p2:PARTS/Site = 8384 AND /p1:Envelope/p1:Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = 1)
OR (/p1:Envelope/p1:Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = 5)
OR (/p1:Envelope/p1:Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = 😎
OR (/p1:Envelope/p1:Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = 9)
Hi,
It should be something like this:
( /p1:Envelope/p1:Body/p2:PARTS/Site = 1622
OR /p1:Envelope/p1:Body/p2:PARTS/Site = 1165
OR /p1:Envelope/p1:Body/p2:PARTS/Site = 4311
OR /p1:Envelope/p1:Body/p2:PARTS/Site = 8374
OR /p1:Envelope/p1:Body/p2:PARTS/Site = 8384 )
AND ( /p1:Envelope/p1:Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = 1
OR /p1:Envelope/p1:Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = 5
OR /p1:Envelope/p1:Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = 8
OR /p1:Envelope/p1:Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = 9 )
The brackets have been rearranged.
Regards,
Alka.
Hi,
Try putting the condition as:
((/p1:Envelope/p1:Body/p2:PARTS/Site = 1165
AND /p1:Envelope/p1:Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = V)
OR
(/p1:Envelope/p1:Body/p2:PARTS/Site = 1165
AND /p1:Envelope/p1:Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = F)
OR
(/p1:Envelope/p1:Body/p2:PARTS/Site = 4311
AND /p1:Envelope/p1:Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = V)
OR
(/p1:Envelope/p1:Body/p2:PARTS/Site = 4311
AND /p1:Envelope/p1:Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = F)
OR
(/p1:Envelope/p1:Body/p2:PARTS/Site = 8384 AND /p1:Envelope/p1:Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = V)
OR
(/p1:Envelope/p1:Body/p2:PARTS/Site = 8384
AND /p1:Envelope/p1:Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = F))
Hope this helps.
Thanks,
Subhajit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks for the suggestion and that would work i suppose but the thing is that it would be very difficult to do because some conditions does not have so few variables as that one. so it would be hard to do single condition for every one...I will try the EX condition..hopefully it will resolve the issue.
I will notify you if it does...
>
> this time I used the EX operator
>
> (/p1:Envelope/p1:Body[(p2:PARTS/Site = "8374" or Site = "4311") and (Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = "8" or p2:PARTCODE/@ID = "9")]
>
> I received Site "8374" and PartCodeID "8" but still no reveivers found :-S
your condition should be something like
/p1:Envelope/Body/PARTS[(Site = "8374" or Site = "4311") and (PARTCODE/@ID = "8" or PARTCODE/@ID = "9")]
from the blog;
In our case the parent node is /p1:MT_Pickfile/Header and moving forward our expression would be
/p1:MT_Pickfile/Header[(field1 = "100" or field1 = "200" or field1 = "300") and (field3 = "AA" or field3 = "BB" or field3 = "CC")]
Note : All the operators would be in lower case. For more details visit this link for a list of XPATH operators.
Now in case we have a condition as follows,
(field3 = "100" or field3 = "200" or field3 = "300")and (field5 = "AA" or field5 = "BB" or field5 = "CC") where field3 is from Header and field5 is from Body.
Here our expression would be;
/p1:MT_Pickfile[(Header/field3 = "100" or Header/field3 = "200" or Header/field3 = "300" ) and (Body/field5 = "AA" or Body/field5 = "BB" or Body/field5 = "CC")]
Note : It is not possible to have any operator like 'and', 'or' etc outside the brackets [ ].
yes you are absolutely right...the solution in the blog that suits my issue is this as you said.
/p1:MT_Pickfile[(Header/field3 = "100" or Header/field3 = "200" or Header/field3 = "300" ) and (Body/field5 = "AA" or Body/field5 = "BB" or Body/field5 = "CC")]
but in this case it is a simple structure where the field3 and field5 is under Header respective Body.
but my structure has several segments where PARTCODE/@ID is a substructure under Body, therefore it create it like this:
(/p1:Envelope/p1:Body[(p2:PARTS/Site = "8374" or Site = "4311") and (Body/p2:PARTS/p2:PART/p2:PARTCODE/@ID = "8" or p2:PARTCODE/@ID = "9")] EX ).
but perhaps it would work like your suggestion..maybe it understands the substructures without needing to write it all out?
Ok I have narrowed it down so now i know that the issue is not because of the condition. I created only a condition with Site 8374 "AND" PartCodeId "8" so that it wouldn't be messed up with other conditions. but still I got "No Receiver Found" error when those inputs was sent. So i guessed that it couldn't be because of the condition since it is pretty simple one. Any ideas?
Why dont you try to use the EX condition and try;
Ref:
/people/shabarish.vijayakumar/blog/2006/06/07/customise-your-xpath-expressions-in-receiver-determination
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.