String list to record list

I am facing a problem here while mapping from a string list to a Record list. I use the string array in may in-array inside the loop´s properties and the record array as the out-array. But the out-array takes only the last value of the in-array. Do you have any idea?

Raphael,

Loop over your string list by making it the in-array. Add one map step in the loop that uses the pub.list:appendToRecordList service to add your string to a string value in the record list.

HTH,

Mark

This works too…

Mark

… and lastly, there’s the built-in service “pub.list:stringListToRecordList” which accepts a stringList and a keyname and produces a recordList with child nodes of the keyname you specify.

-mdc

Mark
Thanks a lot for your tips they really helped me.

Mark there is one problem, I used your first tip and it works very well when I have only one string list but i have three in this case how can I do

Raphael,

Let me be sure I understand what you need to do. You have three string lists with the same number of elements and you want to combine them so that you have a recordlist with three child elements in each entry.

For example you have three string lists strList1, strList2 and strList3 which each have 10 elements and you want to create a single recordlist, recList1, that has 10 child nodes each containing three strings (one from each of the source lists).

If so, then the attached java service may get you started. You could also do this with Flow by first creating your recordlist with the right number of child elements and then looping over each string list in turn to assign the stings in each element of the record list appropriately.

In this case, I think it is more straightforward to use a java service since you only have to loop through the lists once.

Hope this helps,

Mark

MergeStringLists java service
mergeStringLists.java (2.8 k)