Let's look at an example of mapping EDI data in map force EDI, which stands for electronic data. Interchange can be the source or target of any mapping involving XML databases, Platt files, web services or other EDI data map force includes full support for the two most popular EDI formats, which are UN at a fact and ANSI X, 12 mat, force also provides support for building web services by mapping EDI and other data sources to web services operations for now let's look at an example of mapping a defect. Data to an XML data structure, first let's, insert the EDI data source by clicking the EDI icon, selecting orders from the list of Edda fact, collections then clicking. Ok. Now we can select an example, EDI file. This sample data will allow us to preview.
The result of the mapping next let's insert the target data structure. We can either click the insert icon on the toolbar or use the insert pull down menu, let's open the menu and select insert XML, schema file, we'll, select order St. And since the XML. Schema is the data target there's, no need to select a sample. XML file mat force. We use the sample EDI data that we specified to execute the mapping. So we can select order as the root element of our schema as I expand. Some elements in our source, you see that there are annotations in gray that supply additional information about each item.
These are optional, and you can turn them on or off with the right-click menu. Ok, let's start creating our mapping first under the group message node, we map. Bgm c106 f-100 4, which is the document identifier to the number element under the order header in the target. Next F, 305 5, the responsible agency code gets connected to the number element under customer in our order schema now, let's, add some data processing functions to our mapping from the EDIFACT function.
Library let's drag a to eight-time function onto our mapping. This function allows us to extract the date/time from the ED. A fact message according to the given format, I need to connect to the. Messages listed in the function to the respective inputs. These messages are found under DTM C, 507, I, connect F 2, 3 8 0 and F 2, 3 7, 9 to the inputs.
And the result of the date/time function gets connected to the received element. Next let's, calculate the price of the order we can drag a multiply function onto the mapping and map F 606 o, which is the quantity to the first function input then I'll find the price amount, which is F 5 1, 8, 8 and connect that to the other multiply input. Finally, the result. Gets connected to the price element in our target data. Now, we're done with our mapping let's. Take a look at the output preview.
You can see that the data we mapped from the ED affect order is now in an XML file that conforms to our schema data model. The date/time is in the proper format and the customer number and prices are included mat, force will also allow you to auto generate Java C++ or C sharp code to automate this conversion in another application.