cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Problem

former_member529475
Active Contributor
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

former_member529475
Active Contributor
0 Kudos

Hi Gaurav,

Thanks for your quick reply. The logic is working fine for the single line items...

Here in the sender side, we have DetailRecords will be repeated multiple times. This time it is throwing the error..

How we can resolve this ... any idea..

Thanks & Regards,

Vasu

Former Member
0 Kudos

Change the context of LINE3 & LINE4 to Records and then try.

Former Member
0 Kudos

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

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Vasu

Change the context for Line 3 and Line 4 to Records this should solve the problem.

Thanks

Gaurav

Former Member
0 Kudos

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