Splitting Merged Entries into Separate Nodes

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Data Sources and Targets > EDI > Customizing EDI Structure >

Splitting Merged Entries into Separate Nodes

Some data elements in the EDI configuration files supplied by default with MapForce are configured to display only one node on the mapping, even if the corresponding data element may occur multiple times in the source EDI file (see also Handling Multiple Consecutive Data Elements). An example of such data element is F3036 of the UN/EDIFACT standard. According to the specification, F3036 can occur up to five times consecutively in the C080 ("Party name") composite (see https://www.unece.org/fileadmin/DAM/trade/untdid/d15b/trcd/trcdc080.htm).

 

In the default UN/EDIFACT collection of MapForce, the data element F3036 is represented through a single node on the mapping. If you draw a mapping connection from this node to a target node, then the connection would create as many items in the target as there are occurrences of F3036 in the source. (This follows the basic rule of MapForce connections, for each item in the source, create one item in the target). However, there may be situations where this is not the desired result, and you need separate nodes for each occurrence of the data element.

 

The goal of the example is, therefore, to create a custom UN/EDIFACT configuration which would display separate mapping nodes for each occurrence of F3036. This would enable you to map each individual occurrence of F3036 to a separate target node. The images below show the EDIFACT mapping component before and after customization.

mf_edi_f3036_merged

Before customization

mf_edi_f3036_unmerged

After customization

The steps required to split the F3036 data element into multiple mapping nodes are as follows:

 

1.Create a custom EDI collection using the existing UN/EDIFACT collection as starting point (see Creating a Custom EDI Collection). This ensures your changes will not affect in any way the default EDI configuration.
2.Open the EDSD.Segment file of your custom collection in an XML editor. (If you want to customize a different EDI flavour, then edit the corresponding .segment file of that particular EDI flavour. For example, for X12, this would be the X12.Segment file.)
3.Find the composite C080 and remove the mergedEntries="5" attribute of the F3036 data element.

<Composite name="C080" info="PARTY NAME">
  <Data ref="F3036" mergedEntries="5"/>
  <Data ref="F3045" minOccurs="0"/>
</Composite>

4.Add the minOccurs="0" attribute to all fields except for the first one. The reason is that, according to the UN/EDIFACT standard, only the first occurrence of the field is mandatory; the others are conditional.
5.Enter a unique node name for each of the fields (for example, F3036_1, F3036_2, and so on). At this stage, the configuration should look as follows:

<Composite name="C080" info="PARTY NAME">
  <Data ref="F3036" nodeName="F3036_1"/>
  <Data ref="F3036" nodeName="F3036_2" minOccurs="0"/>
  <Data ref="F3036" nodeName="F3036_3" minOccurs="0"/>
  <Data ref="F3036" nodeName="F3036_4" minOccurs="0"/>
  <Data ref="F3036" nodeName="F3036_5" minOccurs="0"/>
  <Data ref="F3045" minOccurs="0"/>
</Composite>

6.Save the edited EDSD.Segment file.

 

You can now view and work with the modified EDI collection in MapForce, as follows:

 

1.On the Insert menu, click EDI.
2.When prompted, select the custom collection created previously (in this example, "EDIFACT.Custom").
3.Select any message type that uses the C080 segment (in this example, "ORDERS - Purchase Order Message").

mf_edi_split

 

The EDI component now appears modified in MapForce (each occurrence of the F3036 data element has a separate node on the mapping).

mf_edi_f3036_unmerged

The technique described in this example can also be used to split merged entries for other data elements, regardless of the EDI flavour.


© 2019 Altova GmbH