Skip to main content Skip to complementary content

Creating a flattening map with multiple outputs

Information noteNote: This feature is available only if you have installed the R2021-04 Studio monthly update or a later one delivered by Talend. For more information, check with your administrator.

Before you begin

  • You have created a hierarchical structure.

About this task

In this example, the input hierarchical structure looks like this:

Procedure

  1. In the Data Mapper tab of the Mapping perspective, right-click Maps in Hierarchical Mapper and click New > Map.
  2. Select Flattening Map - Create a map which flattens an input structure and click Next.
  3. Select a folder and enter a name for the map, then click Next.
  4. Select the structure that you want to flatten and click Next.
  5. Select a folder and enter a name for the new structure, then click Next.
  6. Select the Multi-output radio button.
    A new Output column appears.
  7. Select the Output check box for each loop that you want to use as output, then click Next.
    Each selected node will be used as the root for a new output. For example, the selection in the image below creates three outputs named Loop-NAD, Loop-RFF and DTM.
  8. Optional: Change the value of the Max Occurs attribute for elements that are not in the pivot.
    • Click the Set Max Occurs for all repeatable elements button to change the value for all repeatable elements.
    • Select one or several nodes and right-click them, then select Set Max Occurs and enter a number. You can select the Apply max occurs to descendant(s) check box if you want to apply this setting to all the descendants of the nodes you selected, then click OK.
  9. Define the parameters for each output.
    You can use the arrow buttons or the drop-down list to navigate between the different outputs.
    1. Optional: Change the pivot by right-clicking the relevant node and clicking Set Pivot.

      The pivot is a path of nodes that starts at the root node and ends at a leaf node. The selected pivot determines the number of rows in the flattened structure.

      You can also remove a node from the pivot by right-clicking it and clicking Remove From Pivot.

    2. Click the Filter primitive fields button to disable the filter and show all non-looping elements.
      This filter is enabled by default and all primitive fields are included in the output structure. If you want to exclude some of these elements, you can disable the filter and clear the relevant check boxes.
      Information noteTip:

      If several outputs contain the same primitive fields, you can use the buttons to the left of the drop-down list to easily apply the same selection to multiple outputs.

      For example, if you want to remove the UNS and UNT columns from all outputs, you can clear their check boxes in the first output and click the Propagate primitive fields selection to next suitable outputs button. The same check boxes will automatically be cleared in the next outputs.

      You can also use the Copy Selection States and Paste Selection States buttons to apply the selection to a specific output.

  10. Click Next, select the Create a Studio schema from the flattened structure check box if needed, then click Finish.
    Information noteNote: If you select this check box, the output structure will use the Map representation by default. If you clear it, the output will use the CSV representation.

Results

Your map and output structures are created. In the selected folder, one structure is created for each output, and another structure is created to combine them. The map opens and the elements from the input structure are automatically mapped with the elements in the output structure.

In this example, it looks like this:

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!