on 10-06-2008 5:06 AM
Hi Experts,
I am doing IDOC -> AS2 Scenario. We have a source structure like
Records (1 .. Unbounded)
Line1 (1 .. Unbounded)
Line2 (1 .. Unbounded)
DetailRecords (1 .. Unbounded)
Line3 (1 .. Unbounded)
Line4 (1 .. Unbounded)
We need the target Structure as
Records (1 .. Unbounded)
Line1 (1 .. Unbounded)
Line2 (1 .. Unbounded)
DetailRecords (1 .. Unbounded)
Line3 (1 ..1) - All the Line3 Items should come in the single line.
Line4 (1 .. 1) - All the LIne4 Items should come in the single line.
Suppose we have 3 LINE3 (example : line3,line3,line3), 4 LINE4 (ex : line4,line4,line4,line4) Items, depends on the runtime, then the result should be Line3 (line3lineline3) and Line4 (line4line4line4+line4)...
How we can achive this in the Message Mapping..
Thanks in advance...
Regards,
Vasu
Hi Vasu
Create a UDF of type queue and assign context Line 3 and Line 4 of detail records. Create the pattern you want and assign to target field. This will work
public void TargetLine( String[] Line, ResulList result,Container container)
{
String output="";
for(int i=0; i<Line.length;i++){
output = output +Line<i>+",";
}
resul.addValue(output)
}
this will generate the output Line3,Line3,Line3 as a single string that you can map to target.
You can modify the code as per required pattern
Thanks
Gaurav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI
If you want construct a single line for all line3 and line4 items of different DetailRecords then change the context of Line3 and Line4 items to Records then it will work fine.
I done small modifications to Gaurav code to cut the comma at end of the string.
{
String output="";
int k=Line.length-1;
for(int i=0; i<Line.length;i++){
if(i!=k)
output = outputLine<i>",";
else
output = output +Line<i>;
}
result.addValue(output);
}
Regards
Sridhar Goli
Hi Vasu
Change the context for Line 3 and Line 4 to Records this should solve the problem.
Thanks
Gaurav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
Keep the context on DetailRecord then write an UDF which has the input as line3 from source then concatenate all the array elements in udf and return final concatenated structure.
Similarly you can do for line4.
Regards,
Ganesh
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 | |
10 | |
7 | |
6 | |
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.