Transforms functions – Split-by-type

The DTC looping functions

Among the pre-defined functions in the TaskCentre Data Transformation Component (DTC), there is a group that is used to apply looping in a data transformation.

There are three looping functions:

  • Simple
  • Split-by-type
  • Interleaved merge

We will briefly look at looping in general before concentrating in this lesson on the split-by-type looping function.

The purpose of the looping functions

A loop is a function that is used to iterate through all the specified elements in a set or array. The iteration is repeated until all the conditions specified for the looping have been met.

The looping functions are used in TaskCentre task design to carry out various kinds of looping during the transformation of data between the data input and the tool input schema.

Looping can affect the flow of data or even, in the case of split-by-type and interleaved merge, change the structure of the data.

Focus on the split-by-type looping function

pic1

You access the split-by-type function from the Looping 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 icon 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.

What is split-by-type looping?

pic2

The split-by-type looping function takes data from a source node in the data input schema and splits it into two or more destination nodes in the tool input schema, based on the elements within the source node.

So, if the source node contains seven records and there are three destination nodes, the split-by-type loop distributes the records so that the three destination nodes between them contain the seven records.

Split-by-type looping in practice

pic3
As an example, you could choose split-by-type looping for the integration of addresses, where the source address is defined by type and the destination address is split by type.

In this situation, the source schema would contain a mixture of address types, with values like DEL for a delivery address and INV for an invoice address. The elements would all be contained within one node called Addresses.

The destination schema would have a separate definition for each address type, implied by the overall schema definition. For example, there may be separate Shipping Address and Billing Address nodes, each containing the necessary elements.

Using the split-by-type function

Let’s take a more detailed look at the example where the split-by-type looping function is being applied to a data transformation splitting addresses.

pic4a

Above: This example shows a mapping where the split-by-type looping function is being used to split addresses.

pic5
pic6

The example above shows the split-by-type looping function has two inputs and two outputs.

One of the inputs identifies the object to be split; the other provides the basis for the split.

pic7

Above: Note that the pane is now titled Transformation Function. After using the Transformation Mappings pane to drag functions and connectors into position between the data and tool input panes, you can use the Function settings to specify or check various transformation settings.

In the tables under the Input and Output tabs, you can view the input and output parameters that have been mapped in the Transformation Mappings pane, together with their mappings.

pic8a

Above: The first input is the node Row, which represents the ObjectToSplit parameter. (This source data comes from a record set and “Row” is referring to “Address”.)

The other input is the element address_type, representing the SplitBasedOn parameter. This element is used to differentiate the address type as either a delivery address or a billing address.

pic9

Above: The tool input (output of the function) contains two elements.

The is_default_billing element identifies the billing address and is mapped from the parameter BillingAddress; the is_default_shipping element identifies the shipping address and is mapped from the parameter ShippingAddress.

pic9

pic10a

Above: Here you can see the split-by-type transformation for our example, shown in terms of our earlier model.

The Split-by-type looping function: In summary

A loop is a function that iterates through all the specified elements in a set or array. The iteration is repeated until all the conditions specified for the looping have been met. Looping may affect the flow of data or even the structure of the data it acts on.

TaskCentre provides three looping functions in the data transformation component to carry out various kinds of looping: simple, split-by-type and interleaved merge.

Split-by-type looping splits data records from a single node in the data input schema and distributes the records across two or more nodes in the tool input schema. It could be used to extract and separate billing and delivery address data from a single source table of address records.

You access the function in the Functions pane of the DTC.

To apply a looping to a data transformation, you drag an instance of the function to the mappings pane. You then add connectors between it and nodes or elements in the data input and tool input panes. You can also open the function’s dialog box and check or set various options there.

Links to related DTC articles