cancel
Showing results for 
Search instead for 
Did you mean: 

Xpath condition - Groups

max_rosn
Participant
0 Kudos

Hi experts,

I need to make several Xpath expressions in order to determine receiver. The expressions works fine, except when I try to group them like this.

Group A and Group B needs to be true in order to route the message.

Group A:

(Xpath./p1:test/variable = "1")  OR

(Xpath./p1:test/variable = "2")  OR

(Xpath./p1:test/variable = "3")


Group B:

(Xpath./p1:test/variable2 = "1") OR

(Xpath./p1:test/variable2 = "2") OR

(Xpath./p1:test/variable2 = "3")


Combined:

((Xpath./p1:test/variable = "1")  OR

(Xpath./p1:test/variable = "2")  OR

(Xpath./p1:test/variable = "3"))  AND

((Xpath./p1:test/variable2 = "1") OR

(Xpath./p1:test/variable2 = "2") OR

(Xpath./p1:test/variable2 = "3"))

The combined expressions does not work. If variable = 1 and variable2 = 99 it still routes to the receiver.

Any ideas?

Br

Accepted Solutions (1)

Accepted Solutions (1)

Eduardo_Rubia
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi, Max,

I believe the "OR" operation does not work quite well when split as this. I did suffer with a similar scenario some time ago.

What worked for me was to group the "OR" operations in separate XPath clauses into a single expression bound by an outlining "AND" argument, such as:

Group A:

(/p1:test[(p1:variable = "1"  OR p1:variable = "2"  OR p1:variable = "3")]


"AND"


Group B:

(/p1:test[(p1:variable2 = "1"  OR p1:variable2 = "2"  OR p1:variable2 = "3")]



Do not forget to use "EX" operation and leave the right operand empty in each line.


Regards,

Eduardo

Answers (2)

Answers (2)

max_rosn
Participant
0 Kudos

Thanks for your replies! It is now working. Actually it was a combination of the grouping like Eduardos suggestion, but also lower case operators were needed.

iaki_vila
Active Contributor
0 Kudos

Hi Max,

Have you entered a space between each operator and each operand, manly in the AND that is the only change with the parenthesis?

You can try something more, in below versions there was a restrictions like the operator should be in lowercase, i think it is not your case for your syntaxes, but you can try.

Check also Shabarish blog

Regards.