on 03-19-2014 5:56 PM
Hi Experts,
Is it possible to concatenate the same field at mapping level and mapped to target field?
Please consider the sample scenario where I have segment S1 which contain Field F1 at source side which may appear twice with different values and both values need to be concatenate and mapped to Field F2 at Target Segment S2. How to achieve the same?
Example
Source Side
<S1>
<F1>This sample text1</F1>
</S1>
<S1>
<F1>This sample text2</F1>
</S1>
mapping logic should contact both and map to target (which should look like below one)
<S2>
<F2>This sample text1 This sample text2</F2>
</S2>
Regards
Faisal
Hello,
Write a UDF.
Execution type: all values of a context
Input var1
String total = "";
for(int i=0;i<var1.length;i++)
{
total = total + var1[i];
}
result.addValue(total);
Mapping
F1 ---Remove Context -- UDF--- Output
Note - check for any syntax errors + corrected type error.
Thanks
Amit Srivastava
Message was edited by: Amit Srivastava
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
use the below UDF and pass the your field to it
String out = "";
for(int i=0;i<var1.length;i++)
{
out = out+var1[i];
}
result.addValue(out);
field -> remove context>above UDF
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Amit - May be you could have noticed the time difference too.. If i had looked at your reply i don' think i can post something in a min gap..
However I was trying to edit my response and update the same.. which i did in many instances..
As you have replied, i was unable to edit it..
P.S : just noticed.. i think it should be total = total + var1[i]; instead of total = total + var1[0]; which is not a syntax error i believe..
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.