Performing Mathematical Operations on XML Data

Use the mathematical operations—add, subtract, multiply, divide, and sum— to apply common math functions to XML data. For example, if an incoming XML document contains an extended price of $42 for 10 of an item, you can use the divide operation to divide the extended price by the order quantity to determine the unit price.

Use the Summation function to total quantities in a repeating group. For example, if you have the following XML, you can use the Summation function to total the amounts in each repeating Price element.

<Item>

<Price>10.55</Price>
<Price>10.49</Price>
<Price>11.50</Price>

</Item>

To perform mathematical operations on XML data:

  1. Access the Business Connect XML mapping utility.

  2. Right-click a transaction in the Trading Partner Tree and select Edit Transaction Map to display the transaction map.

  3. In the Target XML column of either the received map or the reply/sent map, right-click the element you want to modify and select Modify Mapping to display the XML Mapping Conversion Editor dialog box.

If the element you selected 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.

  1. From the Operations field, double-click Add, Subtract, Multiply, Divide, or Summation to add it to the Operation Stack field.

  2. If necessary, move the operation to the correct place in the operation stack.

  3. Click OK to return to the mapping utility main window.

  4. From the File menu, select Save Transaction Map to save the map.

See Also:

Modifying Incoming and Outgoing XML Data Overview