cancel
Showing results for 
Search instead for 
Did you mean: 

SAP MII XML xpath range

former_member191528
Participant
0 Kudos

Hello All,

Is there a way to get  a range of nodes in SAP MII XML using xpath ? For example I have a query with 1000 rows and I want to take a batch of 2 rows and process them using a separate branch until I reach the end of the XML.

I am using a For Next Loop for it & I am using the following XPath based on what I found online. Its still not working. ?

Data.Results{/Rowsets/Rowset//Row[position() >= For_Next_Loop_0.CurrentItem and position()  < (For_Next_Loop_0.CurrentItem + 2)]}

Any ideas ?

Thanks,

Kiran

Accepted Solutions (1)

Accepted Solutions (1)

former_member185280
Active Contributor
0 Kudos

I think you need to reference the current item number dynamically by surrounding the parameter with pound signs: #For_Next_Loop_0.CurrentItem#

To do what I think you are trying to do I would probably use the for next with an increment of 2 and then get the two rows with something like Data.Results{/Rowsets/Rowset/Row[#For_Next_Loop_0.CurrentItem#]} to get the first and Data.Results{/Rowsets/Rowset/Row[#For_Next_Loop_0.CurrentItem#+1]} to get the second.

Regards,
Christian

former_member191528
Participant
0 Kudos

Hi Christian,

Thanks for the reply but from 10 rows I to filter rows 1,2 then 2,4 then 5,6. I wanted to specify a range in the xpath to get the subset.

Thanks,

Kiran

former_member185280
Active Contributor
0 Kudos

Well my suggestion may still work with an increment of 1. I don't have access right now so I can't help you out if you need the rows as one xml fragment.

Regards,
Christian

former_member191528
Participant
0 Kudos

Thanks Christian !! I had figured out the adding the # part. But the range is getting a bit tricky

This is what I am looking for

XML Document

NameValue
A1
B2
C3
D4

Batch 1

NameValue
A1
B2

Batch 2

NameValue
C3
D4

Thanks,

Kiran

Answers (0)