In the Graphical Data Mapping editor, you can use the fn:sum transform to set the value of an output element to a numeric type that is the result of the sum of all the values in a sequence. You can also use the fn:sum transform to set the value of an output element to the sum of durations in a sequence.
You can use the XPath 2.0 function fn:sum(arg1, arg2) to sum numeric or duration values in a sequence.
The fn:sum transform is the representation of the fn:sum XPath function in the Graphical Data Mapping editor.
You can have any number of inputs to the fn:sum transform. These inputs can be used to define the arguments of the fn:sum function.
You can connect one or more inputs to the fn:sum transform. These inputs are used to define the arguments of the fn:sum function.
The Cardinality property determines the elements (also known as indexes) in the repeating input element that are processed by the fn:sum transform.
You can configure the Input array indexes section to select specific instances of the input array. For more information, see Selecting the indexes of input array elements.
You can use any of the input elements to the fn:sum transform to define a conditional expression that defines the condition under which the transform is applied. If the condition evaluates to true, the transform is applied.
For more information, see Configuring the properties of a transform.
In the following figure, the fn:sum transform has four inputs and the fn:sum function has two arguments.
The input E is of type string and is cast to an integer type.
The second argument zero is set to the value of multiplying two input elements.
The fn:sum transform returns 11147 for the following input message:
<?xml version="1.0" encoding="UTF-8"?>
<NewElement>
<A>10</A>
<C>2</C>
<C>10</C>
<D>1000</D>
<E>120</E>
</NewElement>