on 09-03-2010 11:07 AM
Hi All,
I have a scenario where I need to populate the first line in the text with just the date and the first sequence' text value. the second line onwards, we need to concatenate the remaining sequence' text values using the input received without date.
My input XML is
<memoList>
<memo>
<seq/>
<date>20090202</memoDate>
<text>1</text>
</memo>
<memo>
<seq/>
<date>20090302</memoDate>
<text>2</text>
</memo>
<memo>
<seq/>
<date>20090402</memoDate>
<text>3</text>
</memo>
</memoList>
My Output XML should be
<HEADER >
<TEXT>200902021</TEXT>
</HEADER>
<HEADER >
<TEXT>23</TEXT>
</HEADER>
How can I acheive this using Graphical mapping?
Thanks,
Sheela R
Hi,
Go for UDF:
Execution type as : All values of a Context.
There will be 2 Inputs : var1 type String
var2 type String
UDF:
int a = var1.length;
String b = "";
result.addValue(var1[0]+var2[0]);
for(int i=1;i<a;i++)
{
b=b+var2 i; ("i" is under square brackets)
}
result.addValue(b);
Ur mapping will be:
var1->RemoveContext
-
UDF--
var2->RemoveContext
Thanks
Amit
Edited by: AmitSri on Sep 3, 2010 1:40 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sheela,
Try this mapping:
On the target staructure, rightclick on HEADER Node and duplicate it for one time.
For the first HEADER Node Text element:
date--->
concat ---> TEXT
text --->
For the second HEADER node Text element:
You have to use UDF here to get the concatenated values of all text elements.
In UDF, read all the values of the Text (except the first one), concatenate & pass the single value to the target TEXT field.
-Supriya.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.