Converting a RecordList to a Comma Separated String

I need to convert a recordList(has a single column) to a string with comma as the delimiter. Could anyone please suggest a quick solution for this?


the final string should look like “1,2,3”

Try this:

loop over /recList (out-array=/strList)
…map /recList/field1 --> /strList
pub.string:makeString (strList–>elementList, ‘,’–>separator)

Of course you’ll need to substitute your variable names at the appropriate spots.

In WMSamples.sample.flatfileparsing folder there is a flow called convertRecordListToDelimitedString

Copy that in your package (copy the shared tab settings manually as well!)

You can choose if you want the columnames as header or not. It works fine, altough I still have trouble to get the recordseparater working (field separator ‘;’ is working fine)

Following Rob’s post, another way to achieve this is

Define finalString = “”;
loop over /recList (out-array=/strList)
…map /recList/field1 --> /string1
string1 += “,”; (string1 = string1 + “,”)
finalString = finalString + string1;

You might have to take out the last comma in this method. But this should work in a simple way.
I am taking my vacation and I am happy. Hope everyone have a great time this holiday season!!!