Table of Contents
The DTC aggregation functions
Among the pre-defined functions in the TaskCentre Data Transformation Component (DTC), there are two that are classed as aggregation functions, Node Count and Sum.
The focus of this article is on the Node Count function.
The purpose of the aggregation functions
The aggregation functions in the DTC aggregate data values during task run time.
They can, for example, be used to
- Count the number of sales order lines within the source XML
- Aggregate the line item total to produce a summary total value per order
The node count function serves the former purpose and the sum function the later.
Focus on the node count aggregation function
You access the Node Count function from the Aggregation category in the Functions pane of the DTC.
To use the function, you drag an instance of it into the Transformation Mapping area.
You can then drag connectors into place between the function box and the required elements in the data and tool input schemas.
You can also open the function’s dialog box by double-clicking the function icon. This lets you set or check various options.
Using the node count function
Let’s take a look at a situation where the Node Count function is being applied to a data transformation.
The example above shows a mapping in the DTC for the Web Service Connector tool for a sales order scenario. This mapping involves several functions.
In the example, there are two simple looping functions, one for the sales order headers and the other for each of the sales order lines within the order headers.
There are also two aggregation functions, one a sum and the other a node count.
Focusing on the node count function, you can see (left) that it is mapped to two data inputs.
There will always be two inputs. One is used to identify the node within which to count.
The other input is used to identify what we want counted in the data input schema; this is usually one of its nodes.
Above: The function will count within each sales order and provide an output of the total number of order lines.
The node count aggregate function takes the order header node salesOrderInfo to count the appropriate element or node.
The node count uses the sales order lines node salesOrderItemEntity to provide the ItemToCount. This will count the number of order lines.
Above: The output is then mapped to an appropriate element in the tool input. This is NumberOfItems for the node count.
(In this example, the other aggregation function, Sum, sums the price elements in a similar manner, to provide the total order value.)
The Node count aggregation function: In summary
The aggregation functions in the TaskCentre DTC are used to manipulate data before passing it to the tool input schema.
Two types of aggregation function are provided, node count and sum. The node count function counts instances of an input data element and provides a total count, while the sum function sums the values of input data elements and provides a total value.
To use the node count function in a data transformation, you drag an instance of it from the Functions pane of the DTC into the Transformation Mappings pane. You then drag connections into position between the function and the Data Input and Tool Input schemas of the DTC.
The node code function maps the appropriate header code in the data input schema to count the appropriate elements or nodes within it. The aggregated output, a total count, is then mapped to an appropriate element in the tool input schema.
You can open the function’s settings dialog box and specify or check various settings, including input and output parameters, mappings and exception behaviour.
- Overview of the (DTC) Data Transformation Component
- Transform functions – External lookup
- Transform functions – Internal lookup
- Transform functions – Fixed/Dynamic
- Transform functions – Run VBScript
- Transform functions – Simple looping
- Transforms functions – Split-by-type
- Transform functions – Interleaved merge looping
- Transform functions – Node count aggregation
- Transform functions – Sum aggregation