cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping problem

Former Member
0 Kudos

Hi experts,

I have a source tag:

<text> 1..1

<item> 0..unbounded

example:

<text>

<item>line1</item>

<item>line2</item>

<item>line3</item>

<text>

and target tag:

<text> 1..1

<items> 1..1

example:

<text>

<items>line1 line2 line3</items>

<text>

How should I map with the graphical mapping to get concatenated all items in one target item?

Any help?

Kind regards,

Danijela Zivanovic

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Use a UDF

cache parameter-context


public void concat(String[] a,ResultList result,Container container)
{
String c = "";
for(int i = 0; i < a.length; i++)
{
   c = c + a<i> + " ";//to get spaces between line1 and line2 in accord to ur example
}
result.addValue(c);
}

item>remove context->UDF(Concat)>split by value>items

Edited by: malini balasubramaniam on Aug 19, 2008 2:02 PM

Former Member
0 Kudos

Hi Malini,

Perfect. Thanks a lot. I already tested and it works.

Kind regards,

Danijela

Answers (1)

Answers (1)

Former Member
0 Kudos

You need to write a UDF of cache Value

String finalString = null;
for(i=0;i<a.length;i++){   // a is input parameter to UDF item 
finalString = finalString + a<i>;
}

return finalString;

item(set context to one level up)---> UDF --> items