cancel
Showing results for 
Search instead for 
Did you mean: 

Receiver determination - Xpath expression problem with count

Former Member
0 Kudos

I am working with a scenario where I pick up records from a JDBC connection and if the number of records I pick up is less than a certain number I want to call a webservice. If it is greater than the number I want to write out a file to be processed by a different process on the receiving end. I have created the receiver determination condition with the following conditions:

(/p1:MT_HOG_Data/row[count(row) > 3] EX)

(/p1:MT_HOG_Data/row[count(row) <= 3] EX)

The integration is always processing the second condition no matter how many records come in. I have tried with and without the multiline option. Can anyone help with this?

I have searched through the forum and checked the following links without any resolution:

http://wiki.sdn.sap.com/wiki/display/XI/XpathConditioninReceiverDetermination

http://help.sap.com/saphelp_nwpi71/helpdata/EN/ab/13bf7191e73a4fb3560e767a2525fd/frameset.htm

/people/shabarish.vijayakumar/blog/2006/06/07/customise-your-xpath-expressions-in-receiver-determination

I can't find any examples where a count of records is checked in the expression editor. Thanks in advance for any help.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You can not use the EX operator in that case, because that is used only for node existence checks, not for value checks.

Do you have a row number in your structure ? Then you could write the xpath expression with that counter tag and value

Example: you want to send to receiver A if count > 3, else to B:

you set /rowNumber EQUAL 4 for sender A

and /rowNumber NOT EQUAL 4 for sender B

The condition is applied to the whole document. If one of the node/values are true for that condition, then the whole condition is set to true.

Problem with that is that the second condition also will be true because nodes for that condition will be found

better would be to have a rowcount tag in the structure. If that is not possible, you can use the "Enhanced Receiver determination" where you can define a mapping which determines the receivers. There you can do anything complicated you want.

CSY

Former Member
0 Kudos

I was able to add the rowcount tage to te incoming file and make it work as you suggested, thanks. I'm just curious if anyone knows of another approach in the xpath without modifying the incoming fle layout. Thanks in advance for any suggestions.

Former Member
0 Kudos

I've tried sthg like this and it seems to work :

/p1:MT_HOG_Data\[count(row) <= 3\]/row EX

/p1:MT_HOG_Data\[count(row) > 3\]/row EX

Rgds

Chris

Edited by: Christophe PFERTZEL on Feb 15, 2010 4:11 PM

Former Member
0 Kudos

Thank you. This was what I was looking for, it works correctly now. Points awarded.

Answers (0)