Recursive Element Mapping/Looping - 6.3

Talend Data Mapper User Guide

EnrichVersion
6.3
EnrichProdName
Talend Big Data Platform
Talend Data Fabric
Talend Data Management Platform
Talend Data Services Platform
Talend MDM Platform
Talend Real-Time Big Data Platform
task
Design and Development
EnrichPlatform
Talend Studio

In XML, it is possible to define recursive elements, that is, an element whose children are the same children as some ancestor of that element. Recursive elements can be mapped in any of the following ways:

  • Recursive Expansion - In the map editor, each recursive element has a menu item called Expand Recursive Elements. Clicking on this will add one level of expansion of the children of the given element. These can be mapped normally, and you can expand as many levels as desired. If the expansion is no longer needed, use the Remove Recursive Child Elements menu item.

    Use this in the case where you have a fixed depth that you need to map your recursive elements to.

  • Recursive Mapping - In this case you have a recursive element in the output that needs to be mapped to some recursive element on the input. You want the recursive elements to dynamically correspond. To do this, use the RecursiveLoop function. This dynamically creates a level of dynamic recursion in the output as it discovers the recursion levels in the corresponding input.

  • Flat to Recursive Mapping - In this case you have a non-recursive input that you want to map to a recursive output. The input has a level number (or one can be computed based on the input state) that defines the depth of the output recursive element. To do this, use the FlatToHierarchyLoop function.