cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PI Receiver Determination - How to check for non existing Element in Condition Editor

christopherko
Explorer
0 Kudos

Hey experts,

in my scenario, i had a lot of incoming xml files. For each file i have to check if there is a specific element in this xml. If the element is existing, the message should be rejected. If the node is NOT existing, the message should be send to the configured receiver.

In the receiver determination, i said that if no receiver is found, the message should be ignored. Now i have to configure the condition, so that only xml-files without the element gets a receiver.

With the given four operations, this is not possible. I searched the internet and found some topics about my problem, but it still dont work. My non-functional solution is:

/p1:Node1/p1:Node2/p1:Node3[not(Element1)]
EX

I also found and tried this, also without success:

/p1:Node1/p1:Node2/p1:Node3[count(Element)
= 0] EX

In both cases, it works exactly the other way it should work – the xml without element gets no receiver, but the xml with the element does.

Can you please give me a hint? 😉 We use PI 7.31

Regards,

Chris

Accepted Solutions (1)

Accepted Solutions (1)

former_member190293
Active Contributor

Hi Chris!

Your second condition definitely should work. Try another one:

//p1:Node1[count(p1:Node2/p1:Node3/Element)=0] EX

Also check if namespace prefixes should be used for any/all elements in XPath and namespace definition is supplied.

Regards, Evgeniy.

christopherko
Explorer
0 Kudos

Hi Evgeniy,

thank you, now it works! I see the difference, but can you explain me, why this works and my solution not? I'd like to learn something for the future 😉

Thank you again!

Regards, Chris

former_member190293
Active Contributor
0 Kudos

Hi Chris!

Frankly speaking, I don't know why it doesn't work with your condition 🙂 Maybe if you provide your payload I could check.

Regards, Evgeniy.

Answers (1)

Answers (1)

Snavi
Active Participant
0 Kudos

Hi Christopher,

try with the below condition

count(/p1:Node1/p1:Node2/p1:Node3[Element]) = 0