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:
- Context: When you drag a query to nest into another,
in the Select Context window, you select a query
that is a parent of the query you are nesting. Both queries must be
from the same data source, have compatible data source schemas, and
placed in template elements that are also physically nested in the
same order. Example: /Query1/Query2/Query3 can
be nested into /Query1/Query2 because /Query1/Query2 is
the parent of /Query1/Query2/Query3.
- Placement: When you drag a query to nest into another,
in the Select Context window, you select none or
you select a query that is not a parent of the query you are nesting.
For example, you can nest a query into a query from a different data
source. In this case, you would not select a query from the same data
source because its context would not match.

Procedure
-
In Document
Studio, drag an element from the Data Source 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.
- Select the query context from the list.
How do you know which context to choose?: 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.
- Click OK.