Developing filters

Filters provide a way to dynamically select a subset of Component Presentations by querying Component metadata. To query custom metadata from your Content Data Store, create queries in your Component Template or Page Template.

The present section explains in general how to create or generate a filter, and how to process the results returned. For a general overview of the classes available for querying and filtering, and for selected examples, refer to one of the following sections:

An exhaustive list of all classes with all their methods and properties is available from the API reference documentation.

To run a query, you create criteria in a Criteria object, feed that object as a parameter into a constructor for the class Tridion.ContentDelivery.DynamicContent.Query, and then run one of the following methods on the class :

ExecuteQuery or executeQuery
Returns an array of Content Manager URIs (unique identifiers) as Strings. Use executeQuery if you only need the URIs of the items. This is typically the case if you intend to pass on the results of the query to another class for further processing, such as PageContentAssembler.
ExecuteEntityQuery or executeEntityQuery
Returns an array of objects matching the query. Use executeQuery if you need direct access to the items' properties.

One (typical) application of filtering is to assemble content on the Web page dynamically. Using filters to assemble content dynamically explains in more detail how to do this.