Creating nested queries

A nested query is a query that is placed inside another query in a template. To nest queries, assign them to child elements.

About this task

Queries are nested either by context or placement:

Procedure

  1. In Document Studio, drag an element from the Data Source Schema view to the template element. When a query is dragged onto an element that has parent element, the dragged query is checked whether it can be run in the context of a parent element query. All the queries that can serve as context are displayed in a Select Context window. The list displays the ID and its textual representation.
  2. Select the query context from the list.
    If you are nesting a query by its context within the data source schema, select the parent query of the query you are nesting. In the list of queries you can select from, the parent query is usually the one with the longest path. Example: If you are nesting /Query1/Query2/Query3, the options you can select for the context are:
    • Incorrect: /Query1
    • Correct: /Query1/Query2
    If you select the wrong query, the query might be iterated the wrong number of times in your output. If you receive a message in the Console view that the query is not correct, the reason might be that the parent context is causing the issue.

    If you are nesting a query by its placement instead of its context within the data source schema, select none. By selecting none, you can place a query inside another query that is from another data source schema or is in a different order than it is structured in the data source schema.

  3. Click OK.

Feedback