cancel
Showing results for 
Search instead for 
Did you mean: 

XPATH condition not executing

SudhirT
Active Contributor
0 Kudos

Hi Experts,

I am stucked with a condition in XPATH which is not executing. I want to use substring function in the Expression Editor. In the source structure field IDTNR at path /ORDERS01/IDOC/E1EDP01/E1EDP19/IDTNR if the field value of IDTNR starts with a D(for eg DADHJI) then I have to block this particular message or else(eg ASHDJKKD) pass for other values. I have tried following ways so far.

(ORDERS01/IDOC/E1EDP01/E1EDP19/IDTNR[(substring(.,0,1) ='D')] EX )

/ORDERS01/IDOC/E1EDP01/E1EDP19/IDTNRhttp://not(starts-with(.,"D"))

substring(ORDERS01/IDOC/E1EDP01/E1EDP19/IDTNR,0,1) = 'D'

And also can some body please expalin what is the meaning of http:// in the second statement as also in thread

Requesting you , please dont forward the links or blogs.

Thanks in Advance.

Sudhir

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

Can you use the following and try:

substring(/ORDERS01/IDOC/E1EDP01/E1EDP19/IDTNR,0,1) = 'D'

Included forward slash ...

Regards,

Sreenivas.

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Sudhir,

Just try with //IDTNR[<condition>]

it should work. Bcos

(//) Expression : Selects nodes in the document from the current node that match the selection no matter where they are

Regards

SudhirT
Active Contributor
0 Kudos

Hi Experts,

Many thanks for your replies.

Finally I have tried all the combinations with XPATH editor but no luck. But when I tried the same condition through BPM, Surprisingly it works out there with

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

So BPM is the one option I am left with. Can somebody please comment on why it is working in BPM and not in Receiver Determination?

Thanks!

Former Member
0 Kudos

Hi,

As i mentioned in earlier reply, have u tried with substring(string, 1, 1)...As here index starts with 1.

Regards,

Sreenivas

SudhirT
Active Contributor
0 Kudos

Hi Sreenivas,

Thank you so much, This was the only thing I dint try.

Here is the answer to my problem, I used like this.

I never knew here indexing starts with 1 instead 0.

(/ORDERS01/IDOC/E1EDP01/E1EDP19/IDTNR[not(substring(.,1,1) = 'D')] EX )

Thanks everybody for your replies!

Answered.

Former Member
0 Kudos

Hello,

Can you check for case sensitive by comparing with 'D' and 'd'.

Regards,

Sreenivas.

SudhirT
Active Contributor
0 Kudos

Hi,

Sreenivas, I have tried with both the cases.Still no luck.

Yes, Prateek that was the editor mistake.But still the purpose is not solved Can you please try this at your end(if have time)

Thanks!

Former Member
0 Kudos

Hello,

Use the idex as (string,1,1);

http://www.w3schools.com/xpath/xpath_functions.asp

Regards,

Sreenivas

Former Member
0 Kudos

Hi Sudhir

I think

 substring(string,start,length) or substring(string,start)

should work on this.

Moreover try with

 contains(String,contain string) or starts-with(String, Starts with String)

I am not sure if it get problem with escape sequences in String. Check again.

You can also use

 substring-before(String, String) or substring-after(String,String)

Thanks

Gaurav

Shabarish_Nair
Active Contributor
0 Kudos

Also make sure you have the multiline option checked.

SudhirT
Active Contributor
0 Kudos

Hi All,

Thanks for the replies!

@Dharamveer, I have tried the suggestion in the link but it dint work here.

@Prateek, I have tried the solution given by you with Namespace and without using namespace, It still not worked.

@Sreenivas, I have tried this also

@Vijay, It is really a nice blog by you but unfortunatly I dint find any solution to my problem.

Thanks All.

What else I can try?

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

Awaiting replies.

prateek
Active Contributor
0 Kudos

Hey Sudhir,

As I said earlier, its just a mistake in posting. The [ character is replaced by http://.

Regards,

Prateek

prateek
Active Contributor
0 Kudos

Check if this works (similar to first expression). Are you providing the namespace too?

/p1:ORDERS01/IDOC/E1EDP01/E1EDP19/IDTNR[(substring(.,0,1)]

I think that http:// is posted by mistake. Doesn't seem to be logical.

Regards,

Prateek

dharamveer_gaur2
Active Contributor
0 Kudos

Hi

Sudhir look this thread might help you to use Substring function