Skip to main content Skip to complementary content

Creating a flattening map with multiple outputs

Before you begin

  • You have created a hierarchical structure.

About this task

In this example, the input hierarchical structure looks like this:
Example of a hierarchical structure with customers.

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 two outputs named customer, and order.
    Choose parameters of the flattening process dialog box.
  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.
      Set Max Occurs for all repeatable elements option highlighted.
    • 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.
      Filter primitive fields option highlighted.
      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 rating column from all outputs, you can clear the check box in the first output and click the Propagate primitive fields selection to next suitable outputs button. The same check box will automatically be cleared in the next outputs.
      Propagate primitive fields selection to next suitable outputs option highlighted in the New Map dialog box.

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

  10. Click Next, and select the Max length of column names check box if you want to set a custom maximum length for the output elements names.
    If an element name exceeds the maximum length, it will be truncated until it fits the limitation. For more information, Flattened structure naming.
  11. 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:

Example of the flattening map.

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!