B2B Integration : Trading Networks Administrator's Guide : Creating Flat File Document Types : Creating a Flat File Document Type : Specifying Attributes to Extract : Transforming Extracted Attributes : Built-In Transformations for NUMBER Data Type Attributes
Built-In Transformations for NUMBER Data Type Attributes
If you extract an attribute that has the data type NUMBER and contains an array of numbers, you can use transform the array into a single value using one of the built-in transformations below.
Format
Description
Average
Calculates the average value of all the numbers in the array.
Minimum
Calculates the smallest number in the array.
Maximum
Calculates the largest number in the array.
Sum
Calculates the sum of all the numbers in the array.
No format
Stores the first value of the array as the value of the attribute.
Note:  
When Trading Networks extracts a NUMBER or NUMBER LIST from a document, it uses the number parsing behavior of java.lang.Number. For example, if the NUMBER or NUMBER LIST contains the value 100zzz, Trading Networks interprets the value as 100, instead of throwing an error as it would if the value were zzz100. If you want to redefine this parsing behavior, you can write a custom transformation service.
Suppose your gateway service extracts the quantity of each item of a purchase order, and you want to sum the quantities of all items. Suppose you defined the following attributes in TN_parms and in the document type:
TN_parms Attributes
Document Type
/TN_parms/itemNumber
itemNumber NUMBER
/TN_parms/quantity
quantity NUMBER
/TN_parms/totalQuantity
totalQuantity NUMBER
summedValue NUMBER LIST
If you select the Sum built-in transformation for totalQuantity, it will sum its values and produce a single number. For example, if the value of totalQuantity is this array:
/TN_parms/totalQuantity = {2, 3, 4, 5}
The value of summedValue will be:
/TN_parms/summedValue = 2 + 3 + 4 + 5
Trading Networks will store the value 14 for totalQuantity.
Copyright © 2016- 2017 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback