Use the extract field operation to extract and copy part of a delimited string and assign it to an element in the database, or to an XML element for a document you are sending. For example, your trading partner sends you a string of data in an XML element that contains three fields separated by delimiters. The second field within that string might be a necessary piece of data to complete a transaction, such as a ship-to ID for an order. Using the extract field operation, you can map the element and tell the system to save only the second field in that string.
Use the extract field operation to save pieces of data from a string that might not always be the same number of characters long. Use the substring operation to extract data from a string that is consistently the same length by indicating which character positions to extract.
To extract fields from delimited XML strings:
Right-click a transaction in the Trading Partner Tree and select Edit Transaction Map to display the transaction map.
In the Target XML column of either the received map or the reply/sent map, right-click the element to modify and select Modify Mapping to display the XML Mapping Conversion Editor dialog box.
If the element you select has a source element mapped to it, the source element displays in the Operation Stack field. If the element is not mapped, the Operation Stack field is blank.
From the Operations field, double-click ExtractField to add it to the Operation Stack field.
The Field Extraction dialog box displays.
In the Field Delimiter field, enter the character that is the delimiter in the string, for example, a comma or a pipe (, or |).
In the Occurrence field, enter the field to extract.
For example, you receive a delimited string that reads 123|4567|89 the string contains three fields, each separated by the | symbol. To copy the values in the second field, enter 2 in the Occurrence field.
Click OK to return to the XML Mapping Conversion Editor dialog box.
If necessary, move the operation to the correct place in the operation stack.
Typically, the extract field operation falls after the data you want to extract:
Add additional sources and operations, as necessary.
Click OK to return to the mapping utility main window.
From the File menu, select Save Transaction Map to save the map.
See Also: