cancel
Showing results for 
Search instead for 
Did you mean: 

Loop Concatenating in Message Mapping

Former Member
0 Kudos

Dear Experts,

We have to Concatenate all the entries of a table in a string field, we want to do with graphical mapping. An example is:

Source:

<ITEM>

<TEXT>A</TEXT>

</ITEM>

<ITEM>

<TEXT>B</TEXT>

</ITEM>

<ITEM>

<TEXT>C</TEXT>

</ITEM>

Target:

<XML>

<TEXT>A B C</TEXT>

</XML>

Somebody knows if it is possible with graphical mapping?

Any help will be appreciated.

Thans and regards,

MML.

Accepted Solutions (1)

Accepted Solutions (1)

PriyankaAnagani
Active Contributor
0 Kudos

Hi,

You can achieve this with simple UDF...

textremovecontext-concatUDF---targetText

public void concatUDF(String[] var1, ResultList result, Container container) throws StreamTransformationException{

String res = "";

for(int i=0;i<var1.length;i++){

res = res" "var1<i>;

}

result.addValue(res);

}

Regards,

Priyanka

Former Member
0 Kudos

Thank you very much.

This has solved my problem.

Answers (1)

Answers (1)

Former Member
0 Kudos

You will need to write an advanced UDF to do this

Using Java code, you could retrieve all the values of a queue and then concatenate them

rgds