on 08-19-2008 12:29 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.