Concat all elements found with Space -- Need help in Mapping

I am mapping from an IDoc to an XML format, in the Idoc I have a document list say

data (Document List)

data[0] (Document)
  name (String)
  value (String) = Hello World

data[1]
  name
  value   = This is concat testing

data[2]
  name
  value    = I need help


data[n]
  name
  value    = Thanks in advance

I need to map them to a target XML format

My requirement is I have to concat all elements (value) found with a space in between each up to 35 characters.

Once that limit is reached start with a new/data element as it can be sent multiple times.

The target xml should be

Hello World This is concat testing I
need help Thanks in advance

Any help is appreciated.

To do this is flow will be really tricky and personally I would suggest you should develop a Java service to this.

Loop over the Idoc list and append all the ‘values’ to one single string.

Later you can use the substring method to break it to 35 characters of each length by knowing the size of the string or either write a java service to break it to 35 characters each.

-Senthil

1 Like

@Stuart Fyffe-Collins how can I write util service for this in java, can you please elaborate more.

In Designer you can create Java services as well as Flow services. If you specify input and output pipeline variables and save the Java service, you can then generate the skeleton Java which manipulates the pipeline. All that is then required to do is to develop the specific Java code which does the string manipulation. If you don’t know Java programming then this will be somewhat tricky for you, hopefully you may have a colleague who can help with that part.

Thanks Senthil,Stuart for looking into this. Using util services I have converted string-list to a single string and later I broke the string to the required characters.