on 05-10-2011 4:11 PM
hello everybody,
i have a very easy mapping to solve. I need change the structure from positional to linear.
I tried using graphical mapping but i was not able to solve.
I think is necessary to use a UDF function but not sure:
the source message is this:
<RECORDS>
<R10>
<F1>3001</F1>
<F2>NR:2</F2>
</R10>
<R10>
<F1>3002</F1>
<F2>VA:1</F2>
</R10>
<R10>
<F1>3003</F1>
<F2>VA:65</F2>
</R10>
<R10>
<F1>3001</F1>
<F2>NR:5354</F2>
</R10>
<R10>
<F1>3002</F1>
<F2>VA:1</F2>
</R10>
<R10>
<F1>3003</F1>
<F2>VA:95</F2>
</R10>
</RECORDS>
and i want obtain this:
<RESULT>
<PLU>
<FIELD1>NR:2</FIELD1>
<FIELD2>NR:1</FIELD2>
<FIELD3>VA:65</FIELD3>
</PLU>
<PLU>
<FIELD1> NR:5354</FIELD1>
<FIELD2> VA:1</FIELD2>
<FIELD3> VA:95</FIELD3>
</PLU>
</RESULT>
any suggestion?
thanks
Alex
Use UDF:
Input will be "a". Execution type : All values of a context
UDF:
String s = "";
for(int z=0;z<a.length;z++)
{
s=s+a[z]+"," ;
}
String[] temp = s.split("3001,3002,3003");
for(int i=1;i<temp.length;i++)
{
result.addValue("");
}
Mapping:
1) F1(change its context to Records)---UDF--PLU
2) F1(change its context to Records)----
-
equals----IfWithoutElse(F2(change its context to Records)
Constant(3001)---
In the same way proceed for the other two fileds Field2, Filed3...
Assumption: The values in F1 are coming in the same order as shown in the post.
Thanks
Amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Yes, use udf it will be the fastest solution. Use udf for whole context, and in input filed change context to higher element
Regards
Maciej
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.