Skip to main content Skip to complementary content

DSQL element path

Availability-noteBeta
In DSQL maps, structure elements can be referenced with an absolute path or a relative path, depending on the context.

Looping context

To understand paths in DSQL maps, it is important to understand the concept of looping context. The looping context describes how to handle elements that can occur multiple times in a structure. In the map below, the output structure has a loop element named items. This element needs a looping context that will associate it with one of the loops in the input structure. In this case, the output should contain one items element for each items occurrence in each departments loop in the input structure. This is defined with the following expression:
FROM departments
UNNEST items
The output items element's looping context is the input items element.

Absolute path

The absolute path of an element describes its position in the structure starting from the root element. The levels in the structure hierarchy are separated by a period. In the input structure from the map above for example, the absolute path for the description element is plusstore.departments.items.description.
Information noteTip: To get any element's absolute path, you can right-click it and click Copy path to clipboard.

Relative path

The relative path of an element describes its position in the structure starting from the element's looping context or the looping context's parent loops. In the map above, you can use the following relative paths:
  • salesperson_id for plusstore.departments.salesperson_id
  • location for plusstore.location
  • description for plusstore.departments.items.description

An element cannot be referenced with a relative path if the path can be ambiguous. In the example above, the input structure contains multiple elements named name under different loops. If the looping context is the input items element, only the name element under items can be referenced with the relative path name. The other name elements must be referenced with their absolute path, plusstore.departments.name for example.

If the looping context changes, some relative paths may be automatically changed to absolute paths if needed. If the looping context in the example above is originally the plusstore.departments loop, you can refer to plusstore.departments.name in the output department_name element with the relative path name. If you then change the looping context to the plusstore.departments.items loop, the relative path name can only refer to plusstore.departments.items.name and the expression in the output department_name element is updated to the absolute path plusstore.departments.name.

Information noteTip: You can always use the absolute path instead of a relative path if you have any doubts about the looping context.

For an example of looping contexts and relative paths, see Mapping nested loops in a DSQL 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!