Book Documentation Cap Tutorials

Filter

Filter+

A filter is essentially a stored search query. In the 'Filter' section you can create, edit and delete filters.

You can use filters not only to easily find items, but also to hook them up to model blocks. This will 'feed' the model block with the items in your filter.

Current filters

The filters currently stored for a particular container/view are shown at the top of the Filter section. Hover over or tap on them, then click/tap the 'Delete' or 'Edit' button to either delete or change a current filter.

If the filters are grouped, change the group by clicking the 'Group' select menu (top left corner) and selecting the desired group.

New/edit filter

The 'Filter' section opens with a form for a new filter by default. Choose a current filter if you want to edit it instead. Both forms are the same.

Regular attributes

Filters have several 'regular' attributes like 'Name', 'Note' and 'Group'. These attributes show up in the overview in het 'Filter' section and in the 'Overview' section of a container/view.

Filter groups

Below this part are the 'filter groups'. This is the actual filter. Every element in a filter group equates to a query, with always the structure field-operator-value. For instance:

Field 'id' is equal to '1'

Click the 'plus' icon next to the first query in the filter group to add extra queries. Remove queries by clicking the 'cross' icon.

You can generate a list of current values for the chosen field by clicking the 'list' icon. The text input field will change to a select menu with up to one hundred options. Click the 'list with cross' icon to switch to the text input field.

Queries within a filter group are 'chained'. You can choose between 'and' and 'or' (top bar of a filter group). This decides how the queries in the group will be chained up:

Field 'id' is equal to '1' and field 'Draft' is equal to '0'

If you want to use both 'and' and 'or' chaining, simply create an extra filter group by clicking the 'plus' icon in the filter group bar. Set the chaining of groups in the 'Options' pane.

Queries for models

Models can require something extra from a filter query. For instance, a fields needs to be matched to an element of a query string. This match, or 'alias', can be anticipated by using an 'alias' operator:

Field 'id' alias • = 'article-id'

Or: the 'article-id' part of a query string is and alias for the 'id' field. The '=' part of the operator determines it should be an exact match to the value of the 'article-id' query string part. The query string:

?article-id=1

...is translated to:

Field 'id' is equal to '1'

Queries with date values

When working with date values, a relative comparison might be necessary. For instance: all items that have a start date which equals today's date. This can be done using 'special values'.

For more info: view the '1202 script' documentation.

Options

Options that apply to the entire filter are adjustable in the 'Options' pane, below the filter groups.

The options are:

  • Limit number of results to/model may adjust limit: puts a limit on the number of items to include in the filter. This limit also applies when using the filter in models. To give the models the freedom to dictate their own limit, tick/tap the box 'Model may adjust limit'. When left blank, there is no limit.
  • Chain groups: determines how the total queries of filter groups are chained.
  • Ignore filter groups: skips any queries entered using filter groups.
  • Show filter to linked users only: if users are linked to this filter, they will be the only users that are able to see it.
  • Allow execution of action with filter/action select: you can make filters 'executable', which means an action will be performed with the result set. For instance, you can delete the entire result set, making a bulk delete possible. Execution can be invoked from either the Filter section (button 'Execute filter', top right) or remotely.
  • Sort: sets a sorting sequence, with per-field options for ascending/descending and numeric. Only the fields listed under 'Include' are used in the sort, with their sequence numbered. Drag and drop fields to change the sequence. To move a field from 'Exclude' to 'Include' or vice-versa, click the green or red 'arrow' icon next to it. The sort also includes a 'Random sort' to retrieve a random result set.

Models

An overview of models that use the current filter is presented in the 'Models' pane. Hover over or tap on a model item and click the 'Edit' button to immediately edit the model. The filter section will remain open in the background. Therefore, you can easily switch between models and filters.

Links

Filters can be linked to users. This means a filter will be shown in a 'My filters' pane at the top of the overview for these particular users.

If you want the linked users to be the only users who can see the filter, check the box next to 'Show filter to linked users only' in the 'Options' pane. By default, filters are visible to anyone.

Actions

The main actions when creating a new filter are:

  • Add this filter: saves the filter and reloads the 'Filter' section, returning to its default state.
  • Add & continue editing: saves the filter and reloads the 'Filter' section, loading the newly saved filter to be edited.
  • Test filter: applies the filter to the container/view content and returns the result as an overview.

The main actions when editing an existing filter are:

  • Update this filter: saves the filter and reloads the 'Filter' section, loading the current filter to be edited.
  • Save filter as a copy: saves a copy of the current filter (including any edits) and reloads the 'Filter' section, loading the current filter (with no edits saved).
  • Test filter: applies the filter to the container/view content and returns the result as an overview.

Tip: if all you want to do is perform an advanced search (without saving it as a filter) just set the filter groups and options and click the 'Test filter' button (top right). From the resulting overview, you can edit/delete items.

The 'Filter' section has two action buttons (top right, in the section bar):

  • New: switches from editing a filter to creating a new one (only visible when editing a filter).
  • Reset: reload the new/edit filter form to void any changes.