2021.2

Table Of Contents
Field Type Description
X'].
type "ContextType" on
page1440
The context type: PRINT, EMAIL or WEB.
Function Description
"query
(selector)"
below
Runs a query across all sections in the Print context. This function is only
available in Post Pagination Scripts, which are only applied to the Print
context. See "Post Pagination Scripts" on page929.
Example
This script checks if the output channel is EMAIL and if the context to be merged is the Print
context (which happens if the Print context is attached to an email). If this is the case, it includes
and excludes certain Print sections from the output.
if (channel == Channel.EMAIL) {
if (merge.context.type == ContextType.PRINT) {
merge.context.sections['Section 1'].enabled = false;
merge.context.sections['Section 2'].enabled = false;
merge.context.sections['Section 3'].enabled = true;
}
}
query(selector)
This function of the context object (see "context" on the previous page) returns a result set,
containing the HTML elements in all sections of the Print context that match the supplied CSS
selector.
The new result set is of the type QueryResults, just like the results object which is also the
result of a (hidden) query (see "results" on page1448), but it is read-only.
This function can only be called in a Post Pagination Script (see "Post Pagination Scripts" on
page929). It is indispensable in a script that creates a table of contents, as described in the
following topic: "Creating a Table Of Contents" on page931.
selector
Page 1446