# Flattened structure naming

When you create a flattening map, a flattened output structure is generated and its elements are named based on the input structure.

The output element names can be generated in different ways if a name is duplicated in the structure.

## Naming duplicated elements

When the flattened output structure is created, every element with a unique name in the entire input structure keeps the same name in the output. However, when there are duplicates, a prefix or suffix is added to differentiate the elements:

* If the duplicate element names are in the same parent element, a suffix with a number is added to all duplicated names. For example, if the input structure contains an element order with two item children, in the output these will be named item\_1 and item\_2.
* If the duplicate elements are in different parent elements, the parent element name is added as a prefix to all duplicated names. For example, if there is an address element under both shipping and billing, in the output they will be named shipping\_address and billing\_address.
* If the step above is not enough to differentiate elements, more parents will be added until a unique name is found. In the example above, if both instances of the address element contain a zipcode element, these elements will be named shipping\_address\_zipcode and billing\_address\_zipcode in the output.

## Truncating element names exceeding the maximum length

By default, the maximum length of an output element name in a flattening map is 128 characters. This can be customized when creating the map.

If an element name exceeds that limit, it is truncated based on the following rules:

* The name is truncated by segments. The segments are the name of the input element and the parents if any are added to the name. No numbers or segments with less than 4 characters are truncated.
* The name is reduced one character at a time, from right to left, starting with the longest segment.

For example, with a maximum length of 30, an element named customer\_billing\_address\_zipcode would be truncated to custom\_billing\_address\_zipcode.

If an element name cannot be truncated to the fit the maximum length, a warning is displayed at the end of the flattening process.