The filter function enables you to filter certain results from a larger collection of data, and may be stacked to further refine the data. There are two ways to filter information, using a set of pre-defined filters, or creating ad hoc filters.
Pre-Defined Filters
Below is a set of filters that are already recognized by the system and does not need to be explicitly declared as a filter:
-
status
-
type
-
locationType
-
jurisdictionRegion
-
country
-
city
-
title
-
office
-
jurisdictionCountry
-
lastName
-
firstName
The status of a locationType or address is contained under the ‘addressStatus’ variable, not status. and must be filtered using an ad hoc filter.
pre-definedFilter:'expectedResult'
Ad Hoc Filters
These are not already defined, and need to be preceded by filter, followed by the variable filter and the expected result. Ad hoc filters may be created from any collection variable.
filter:'adHocFilter':'expectedResult'
General Syntax
-
Use the vertical pipe | to separate each distinct filter from the collection variable
-
Colons separate the filter from the expected result, which is enclosed in 'single quotes'
{#collectionVariable | filter:'expectedResult'}
Note on Filter Syntax
-
Pre-defined filters do not need to be enclosed in single quotes, whereas it is required for ad hoc filters. All expected results must be enclosed in single quotes.
-
Filters may be stacked in order to refine the output; there is no limit to how many filters may be used. However, filtering the results too finely may result in no output.
{#collectionVariable | pre-definedFilter:'expectedResult' | filter:'adHocFilter':'expectedResult'}
Note on Expected Results
-
Expected results may also be stacked to capture more than one result. Colons separate each expected result, which are enclosed in single quotes. In other words, the colon : when used between multiple expected results can be read as “or”
-
The ! syntax may be used with the expected result variable in order to exclude such result
{#collectionVariable | filter:'expectedResultA':'expectedResultB' | filter:'!excludedResult'}
Examples
|
Filters |
|
---|---|---|
Sample Dataset |
Directors: Veronica Mars (Canada) - confirmed |
|
|
Pre-Defined Single Result |
Ad Hoc Single Result |
Filter |
status:'confirmed' |
filter:'taxCountry':'Canada' |
Meaning |
Show only confirmed directors |
Show only directors from Canada |
Input |
{#directors | status:'confirmed'}{firstName} {/} |
{#directors | filter:'taxCountry':'Canada'}{firstName} {/} |
Output |
Veronica Wallace Vinnie |
Veronica Wallace Meg |
|
Pre-Defined Multiple Results |
Ad Hoc Multiple Results |
Filter |
status:'confirmed':'incoming' |
filter:'taxCountry':'Canada':'Mexico' |
Meaning |
Show confirmed and incoming directors |
show directors from Canada and Mexico |
Input |
{#directors | status:'confirmed:'incoming'}{firstName} {/} |
{#directors | filter:'taxCountry':'Canada':'Mexico'}{firstName} {/} |
Output |
Veronica Logan Wallace Vinnie |
Veronica Duncan Wallace Meg |
|
Pre-Defined Excluded Result |
Ad Hoc Excluded Result |
Filter |
status:'!confirmed' |
filter:'taxCountry':'!Canada' |
Meaning |
Show all directors who are not confirmed |
Show all directors who are not from Canada |
Input |
{#directors | status:'!confirmed'}{firstName} {/} |
{#directors | filter:'taxCountry':'!Canada'}{firstName} {/} |
Output |
Duncan Logan Meg |
Duncan Logan Vinnie |
|
Combining Pre-Defined and Ad Hoc Filters |
|
Input |
{#directors | status:'confirmed' | filter:'taxCountry':'Canada'}{firstName} {/} |
|
Meaning |
Show the first names of only confirmed directors from Canada |
|
Output |
Veronica Wallace |
|
|
Stacking Multiple Results and Excluding Results |
|
Input |
{#directors | status:'outgoing':'inactive' | filter:'taxCountry':'!Canada'}{firstName} {/} |
|
Meaning |
Show the first names of all directors who are outgoing or inactive, not from Canada |
|
Output |
Duncan Meg |