cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Using substring in the XPATH expression for Receiver Determination

matt_austin
Explorer
0 Likes
2,550

Hello, I need a little help please. In my receiver determination, I have a condition and I need to do a "not like" check. Basically, if the first three positions of the source field does not start with a specific code, then I need to execute the condition. The condition editor does not support a "not like" operand, so I went to the XPATH expression editor. I tried to used the XPATH substring function to get the first three characters and then do a "not equal" operand, but it doesn't appear to work. There are not any runtime errors, but the condition is not executing. Any ideas on this? Does the XPATH expression support the substring function?

View Entire Topic
Former Member
0 Likes

Hi Matt,

You can use the following method:

1) Specify an XPath in the Condition Editor. For example if you want to check that there is not a Material that starts with 123.

/p1:PRODUCT/MATNR[not(starts-with(.,"123"))]

2) Choose EX (exists) for the Operator and then don't fill in anything for the Right Operand.

Thanks,

Jesse

matt_austin
Explorer
0 Likes

That did the trick! Thanks so much for your help Jesse!!

Former Member
0 Likes

Matt,

Good, I'm glad it worked. If you need to check the end of a string, there's not an ends-with function until XPath 2.0 (XI 3.0 only support XPath 1.0) so you can use a combination of the substring and string-length functions:

/p1:PRODUCT/MATNR[not(substring(.,string-length(.) - 2) = '123')]

Thanks,

Jesse

SudhirT
Active Contributor
0 Likes

Hi Jesse,

Can you please explain what is the meaning of http:// in the statement

/p1:PRODUCT/MATNRhttp://not(substring(.,string-length(.) - 2) = '123')

Please explein, I am having same issue. It is not working here.In My case it is

/p1:ORDERS01/IDOC/E1EDP01/E1EDP19/IDTNR[http://not(starts-with(.,\"D\"))]

also tried with

/p1:ORDERS01/IDOC/E1EDP01/E1EDP19/IDTNR[http://not(starts-with(.,'D'))]

Thanks in advance!