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 variables that are already recognized by the system as a filter and does not need to be explicitly declared as such:
|
|
|
NOTE: The status of an address is stored as the ‘addressStatus’ variable, not 'status' and must be filtered using an ad hoc filter.
Syntax
filterVariable:'filterValue'
Ad Hoc Filters
For the cases where the above pre-defined filters are not sufficient for filtering the data, Athennian allows you to use any variable as a filter. These are not already defined, and need to be explicitly declared as a filter, followed by the variable filter and the expected result. Ad hoc filters may be created from any collection variable.
Syntax
filter:'filterVariable':'filterValue'
A Note on Filters
- 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 (ie. using too many filters) may result in no output.
To filter for a list of past Directors who have resigned, we can stack these filters:
status:'inactive' | filter:'role':'Director' | filter:'endReason':'Resigned'
- The filter values (or the expected result) may also be stacked to capture more than one result. Colons separate each filter value, which are enclosed in single quotes. In other words, the colon
:
when used between multiple expected results can be read as “or”.
To filter for a list of all Directors and Officers, we can stack these values:
filter:'role':'Director':'Officer'
- The
!
syntax may be used with the expected result value in order to exclude the same
To filter for all current and incoming principals, we may choose to exclude any inactive ones:
status:'!inactive'
Examples
Sample Principal Data | ||
Name | Role | Status |
Aaron Arboretum |
Director | confirmed |
Angelica Albumen |
Director | pending |
Brittany Botany | Officer | confirmed |
Byron Bulb | Officer | inactive |
Carlos Chlorophyll | Officer | confirmed |
Cassidy Calyx | Director | inactive |
Daniel Deciduous | Officer | confirmed |
Dolores Digitalis | Officer | pending |
Everett Evergreen | Director | confirmed |
Single Filter: Status or Role
Pre-defined Filter | Ad Hoc Filter | |
Input |
{#affiliations | status:'confirmed'}{participant_fullName} {/} |
{#affiliations | filter:'role':'Officer'}{participant_fullName} {/} |
Output |
Aaron Arboretum Brittany Botany Carlos Chlorophyll Daniel Deciduous Everett Evergreen |
Brittany Botany Byron Bulb Carlos Chlorophyll Daniel Deciduous Dolores Digitalis |
Multiple Filters: Status & Role
Input |
{#affiliations | status:'confirmed' | filter:'role':'Director'}{participant_fullName} {/} |
Output |
Aaron Arboretum Brittany Botany Carlos Chlorophyll Daniel Deciduous Everett Evergreen |
Multiple Expected Results (Filter Values): Role is Director or Officer
Input |
{#affiliations | filter:'role':'Director':'Officer'}{participant_fullName} {/} |
Output |
Aaron Arboretum Angelica Albumen Brittany Botany Byron Bulb Carlos Chlorophyll Cassidy Calyx Daniel Deciduous Dolores Digitalis Everett Evergreen |
Excluded Result: Status is Not Inactive
Input |
{#affiliations | status:'!inactive'}{participant_fullName} {/} |
Output |
Aaron Arboretum Angelica Albumen Brittany Botany Carlos Chlorophyll Daniel Deciduous Dolores Digitalis Everett Evergreen |