Component Query
The Component Query Template Building Block selects items from a Content Manager Folder. You can specify which items to select, how to filter them, sort the results and limit them to a maximum.
Use
You will typically use Component Query as the first Template Building Block of a Compound Page Template to determine which Components to add to the Page. You can also use Component Query to further filter an already selected set of Components in the input package.
You can use this Template Building Block directly in a Compound Page Template, or indirectly by adding it to a Compound Template of type Template Building Block and then adding this Compound Template to a Compound Page Template.
Parameters
This Template Building Block has the following parameters:
- Folder to query
- The Content Manager Folder from which you want to extract Components. In Template Builder, click the Browse button next to this parameter to open a Browse dialog in which you can select a Folder in the current Publication. In this dialog, click OK to confirm the Folder you select, or Cancel to abandon the operation.
- Limit to Schema
- A Schema on which Components are filtered (in addition to other filtering options). In Template Builder, click the Browse button next to this parameter to open an Open Schema dialog in which you can select a Schema in the current Publication. In this dialog, click OK to confirm the Schema you select, or Cancel to abandon the operation. To clear this parameter, click the Delete button next to it.
- Filter expression
-
A Boolean expression that must evaluate to
truefor a Component in order for it to be included in theComponentsarray in the output package produced by this Template Building Block. This Boolean expression has the same syntax as the Boolean expression in an Adobe Dreamweaver Template. Refer to Template expression language to learn which Boolean expressions you can create. Here are some examples of valid Boolean expressions. - Sort by
- An expression indicating what aspect of the Component to sort on. This expression is either a (metadata) field of the Components themselves, or the Title or ID field of the Schema on which the Components are based.
- Sort direction
- Either Ascending (default if left empty) or Descending, indicating the direction of the sort. Leave this parameter empty if Sort expression is empty.
- Maximum amount
-
An integer that indicates the maximum number of Components to include in the
Componentsarray in the output package. - ComponentTemplateURI
- A String containing the TCM URI of the Component Template to use with the Components retrieved from the list (to create Component Presentations). The parameter is an additional (or) filtering option; Components based on the linked schemas of the Component Template are included in the output.
- Target Item Name
-
Specifies the name of an item in the input package to process instead of the item called
Components. The processed item will have the same name.