SimpleLoop - 8.0

Talend Data Mapper Functions Reference Guide

Version
8.0
Language
English
Product
Talend Big Data Platform
Talend Data Fabric
Talend Data Management Platform
Talend Data Services Platform
Talend MDM Platform
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
Design and Development > Designing Jobs
Last publication date
2023-10-26
Creates a loop based on an input map element.

The SimpleLoop function specifies that the output map element associated with the loop expression tab is to loop corresponding to the value of the input map element argument expression.

When an input map element is mapped to an output map element that loops, the SimpleLoop function is automatically created at the nearest ancestor looping output element to define the loop. If no sort keys are specified, the order of the output is the same order as the input elements.

This function can only be used in the Loop tab or as part of an Aggregate expression.

Arguments

Input Map Element Add a looping element from the input structure.
Filter Specify an expression that returns a Boolean. This expression is evaluated for each instance of the loop. If this filter expression returns true, the instance is included in the loop. If it returns false, the instance is excluded from the loop.
Sort Keys Use the AscendingSort or DescendingSort function to sort loop iterations. You can use as many as needed.
Contexts Specify the context using the EnclosingContext or NestedContext function. EnclosingContext specifies the output map element that encloses this loop. If not specified, the nearest looping ancestor map element is used.

Properties

Distinct Option Select Direct Child if you want to select the Distinct Child Element in a list of direct child elements of the looping input element, or Element XPath if you want to enter an XPath to reference a different input element.
Distinct Child Element If you have selected the Direct child option, select the input map element to be used to select distinct values. If selected, only iterations of the loop that have distinct values for the selected element are considered. If this is not selected, all instances of the input map element are considered.

When a loop contains duplicated sub-elements, the Distinct Child Element field provides a filter to get only one instance of each distinct sub-element.

Distinct XPath If you have selected the Element XPath option, enter an XPath expression to evaluate the distinct elements. If the input representation used is not XML, specify the representation in the expression.

For example, if you want to use the fn:concat function on elements named a and b in a CSV representation, the expression should look like this: fn:concat(CSV:a,CSV:b).

Disable sort by distinct child If you have specified a Distinct Child Element, select this check box to keep the default sorting instead of sorting by distinct child. If this check box is not selected, the output is sorted in ascending order based on the value of the Distinct Child Element.
Emit Loop Instance If Empty Select this check box if you want to generate a single instance of this loop in the output if there are no instances of the input loop. This is useful to generate loop instance with a default value.
Stream Input Select this check box to allow the input data for this loop to be broken into chunks and processed separately. Without this option, the entire input data is read into memory before the transformation is executed. When Stream Input is selected, since the transformation is processed in segments, input data of unlimited size can be processed.

When Stream Input is selected there are some significant restrictions on the transformation expressions. For more information, see Streaming execution.