cancel
Showing results for 
Search instead for 
Did you mean: 

Receiver Determination Condition

Former Member
0 Kudos

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)

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

(/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

Former Member
0 Kudos

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

Former Member
0 Kudos

Site & PARTCODE are two different fields which can have any value at runtime, so use OR to satisfy/select any one Site and then same thing with PARTCODE, use OR to satisfy/select any one PARTCODE. Now put AND between Site and PARTCODE to make a unique key.

This is how it should work.

Former Member
0 Kudos

no here we are specifing that the condition to be satisfied if SITE = 1 || 2 || 3 and PARTCODE = A || B

means that site can have any value 1 or 2 or 3 and partcode can have a or b

check out your scenario by giving this

Rajesh

Former Member
0 Kudos

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)

Shabarish_Nair
Active Contributor
0 Kudos

ref. my blog i mentioned earlier.

in that you will find a similar condition as your. try to implement it using the EX operator.

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi Alka, I see how you are thinking but how could I rearrange the brackets manually? as far as I can see XI itself creates the conditon layout.

Shabarish_Nair
Active Contributor
0 Kudos

if you look at the blog you will find that you can manually edit all the brackets and conditions

Answers (2)

Answers (2)

Former Member
0 Kudos

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.

Former Member
0 Kudos

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...

Former Member
0 Kudos

So better to go for that as individual does nt work for you which suppose to be

Rajesh

Shabarish_Nair
Active Contributor
0 Kudos

if the condition is complex its preferable to use the EX operator ... and remember to check the multiline option in the condition editor.

Lemme know if it worked.

Former Member
0 Kudos

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

Shabarish_Nair
Active Contributor
0 Kudos

>

> 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 [ ].

Former Member
0 Kudos

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?

Former Member
0 Kudos

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?

Shabarish_Nair
Active Contributor
0 Kudos

did you try with only the site?

check if it at least works with one condition.. i.e without the ' and '

Shabarish_Nair
Active Contributor
0 Kudos

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