cancel
Showing results for 
Search instead for 
Did you mean: 

Fetching the value in a list for a given index position

Former Member
0 Kudos

Hi All,

I have a Transaction.InputParamaterList of type list

InputParamaterList : [[string:Parameter1], [string:Parameter2], [string:Parameter3], [string:Parameter4]]

Now i need to loop through the list, so ill be using size (InputParamaterList ) and i need to get the value from a list by specifing its postion.But there was no built in function to acheive this for example if position=2, then it should return Parameter2.

Please let me know if any one knows how to achieve this.

(I am using SAP MII Version 12.1.8 )

Regards,

Sireesha

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sireesha

I was also suprise not finding an expression to get value from the list. However I think I got a solution to your problem.

So based on your example:

InputParamaterList : [string:Parameter1, string:Parameter2, string:Parameter3, string:Parameter4]

To get value of item2, you need to remove item1 from the list and then get the first item (but firstly create a local variable to store your transaction variable).

The expression will be first(remove(InputParamaterList,0))

This mean if you need to get value of item 3 you need to remove 0 two times. The expression will be

first(remove(remove(InputParamaterList,0),0)

Maybe there are better way to do it...

0 Kudos

use String_List_to_XML and use the index property from a repeater or wherever you the the position information to select the row of interest.

Regards,

Mike

matthias_hollstein
Participant
0 Kudos

Hello

first(remove(remove(remove(stringtolist(<SAPMEROUTERBO>,","), 0), 0,), 0) works fine for me

that is much more comfortable then creating string parts with dynamic string length and index of calculation

thank you very much

regards

Matthias

for example:

Transaction.sRouterRef=RouterBO:1234,144714-1,U,A-2

first(remove(remove(remove(stringtolist(Transaction.sRouterRef, ","), 0), 1), 1)) Result=144714-1

first(remove(remove(remove(stringtolist(Transaction.sRouterRef, ","), 0), 0), 0)) Result=A-2

first(remove(remove(remove(stringtolist(Transaction.sRouterRef, ","), 0), 0), 1)) Result=U

or:

first(remove(stringtolist(Repeater_0.Output{/responses/production:sfcRef}, ","), 0)) Result=Sfc

Answers (1)

Answers (1)

Former Member
0 Kudos

Sireesha,

below you will find the solution to read the listvalues. Please remember that the List starting with index 0.

Transaction.InputParamaterList{#For_Next_Loop_0.CurrentItem#}

BR

Pedro Iglesias

Former Member
0 Kudos

Thanks for the replies... Solved Problem.