cancel
Showing results for 
Search instead for 
Did you mean: 

Help on grouping and context handling

sahithi_moparthi
Contributor
0 Kudos

Hi,

I have a query on the below Scenario.

<Recordset>
     <Field1>100</Field1>
      <Field1>Rail</Field2>
       <Field1>1</Field3>
</RecordSet>
<Recordset>
     <Field1>101</Field1>
      <Field1>Van</Field2>
       <Field1>2</Field3>
</RecordSet>
<Recordset>
     <Field1>100</Field1>
      <Field1>Car</Field2>
       <Field1>3</Field3>
</RecordSet>

Please find the below query:
1.I have to group based on the field1.So,in the above example i have 3 Recordset,in which 2 have the same value in field1 so i have to group and  need to create one IDOC.
2.In IDOC,i need to repeat the Item segment,which depends on the Field2.As per the above example,i need to cretae 2 Item segments.

Output should be like:

IDOC -1
Header 100
Item   Rail
Item Car

IDOC-2
Header-101
Item-Van

Could any one please help me how to acheive this functionality.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Use the below logic.

Regards

Venkat

rajasekhar_reddy14
Active Contributor
0 Kudos

Try below mapping logic..

Field1--->removecontext--->sort--->splitbyValue(valueChange)--->collapseContext--->IDoc.

                      RecordSet--->removecontext---------------------------->

                                                                                                         ------>formatByExample--->Item.

Field1--->removecontext--->sort--->splitbyValue(valueChange)--->

Set Field1 context to recordset.

Former Member
0 Kudos

Hi Santhosi,

I think there's two parts to solving this:

  • Sort the Recordsets on the values in Field1. This can be done using an xslt mapping (using xsl:sort).
  • Create a graphical mapping that makes use of the splitByValue (Value changed) function to create the required output

Hope this helps.

Kind regards,

Koen