Splitting flat file with multiple rows into multiple messages

0 votes
asked Aug 26, 2022 by randy-c-3449 (200 points)

I have a similar situation as

.However the flat file is not the source, it is imbedded in C-Data in an HTTP call.  I can successfully extract the flat file, save it in messageCache and create an XML message for the output messge when there is only one row in the flat file.

How can I create one XML message for each row when there are mutlple rows in the flat file?

1 Answer

0 votes

Depending on the web service response you can split the content by carriage return (\r) or line feed (\n). or both like I did in my example. 

var responseArray = StringUtils.splitByWholeSeparator(wsResponseContent, '\r\n');

for (var i=0 ; i < responseArray.length ; i++) {
   messageCache.setValue('key'+i, responseArray[i]);

answered Aug 26, 2022 by michael-h-5027 (14,030 points)