Introduction to Filter Expressions
Filter expressions are integrated into various parts of the BizzStream platform to provide granular control over data visibility and relationships. Here's a detailed look at where you'll encounter them and how to apply them.
Filter Expressions
Filter expressions are SQL-like conditions that are used to filter documents. In filter expressions, you can incorporate text expressions by enclosing them in double curly braces ({{ }}). For example, the following filter expression selects documents where the "price" field is greater than 0 and less than a value set in the "maximumValue" field.
price > 0 AND price < {{F["maximumValue"]}}
Where Are Filter Expressions Used?
They will be all explained further in their own individual documentation. A quick preview of what each expression is used for is described here:
| Location | Purpose | Description |
|---|---|---|
| Document Definitions — Reference | Reference Filter | Defines filters for reference fields within a document definition. |
| Document Definitions — Workflow | Scheduled Action Filter | Pre-filters which documents the scheduled action runs on. Only documents matching the filter are processed. |
| Document Definitions — Workflow | Event Action Filter | Pre-filters which documents the event action runs on. BizzStream expressions inside {{ }} have access to the event info object. |
| Layouts | Dataset Filter | Applies a filter to a dataset. |
| Menus | Menu Block Filter | This is a crucial point in the dataset filters in these menu blocks. Can filter a document out of a whole dataset. |
Filter Comparison Operators
| Operator | Description | Usage/Example |
|---|---|---|
= or IS |
Checks if values are equal. | {{F['price']}} IS 5 |
<> or != or IS NOT |
Checks if values are not equal. | {{F['price']}} IS NOT 5 |
> |
Checks if a value is greater than another. | {{F['price']}} > 5 |
< |
Checks if a value is less than another. | {{F['price']}} < 5 |
>= |
Checks if a value is greater than or equal to another. | {{F['price']}} >= 5 |
<= |
Checks if a value is less than or equal to another. | {{F['price']}} <= 5 |
BETWEEN |
Checks if a value falls within a given range. | {{F['price']}} BETWEEN 1 AND 10 |
IN |
Checks if a value exists within a list. | {{F['price']}} IN [5, 4, 3] |
NOT IN |
Checks if a value does not exist within a list. | {{F['price']}} NOT IN [4, 3] |
CONTAINS |
Checks if a field contains a specific substring. | CONTAINS({{F['name']}}, 'Duit 8') |
NOT CONTAINS |
Checks if a field does not contain a specific substring. | NOT CONTAINS({{F['name']}}, 'Duit 8') |
ISBLANK |
Checks if a field has no value. See below. | ISBLANK(fieldName) |
NOT ISBLANK |
Checks if a field has any value. See below. | NOT ISBLANK(fieldName) |
These operators can also be used in combination with BizzStream Expressions. The linked documentation offers essential insight into filter usage and the flexibility they support.
Chaining Operators
| Operator | Description |
|---|---|
AND |
Returns documents where all specified conditions are TRUE. |
OR |
Returns documents where at least one condition is TRUE. |
These operators allow you to chain filter comparison operators. For example:
number >= 5 AND number IS NOT 10
This ensures that number, which can be changed per use case, is greater than or equal to 5 and is not 10.
Logical Operators
| Operator | Description |
|---|---|
IF |
Enables a picking between two filter conditions based on a condition. |
IF({{F["price"] > 5}}, status = 'active', date = {{TODAY()}})
If condition {{F["price"] > 5}} resolves to a truthy value, then
status = 'active' will be used as the filter, otherwise date = {{TODAY()}}
will be used.
Empty Field Operators
The ISBLANK and NOT ISBLANK operators let you filter documents based on whether a field has a value or not. They do not require a comparison value.
| Operator | Returns documents where… |
|---|---|
ISBLANK |
The field is null, "" (empty string), [] (empty array), or missing. |
NOT ISBLANK |
The field has any value (including 0, false, or non-empty strings). |
Syntax
ISBLANK(fieldName)
NOT ISBLANK(fieldName)
Examples
ISBLANK(email)
email field is empty, null, or missing.
NOT ISBLANK(email)
Returns all documents where the email field contains a non-empty value.
NOT ISBLANK(email) AND 'country' = "NL"
Returns documents where email has a value and country equals "NL".
NOT ISBLANK(journalEntryLine)
Returns documents that have at least one journalEntryLine line. Because an
empty line block is stored as an empty array ([]), ISBLANK and NOT ISBLANK
are the correct way to check for line existence in a filter expression.
Getting Started
To start using these filters, begin by reading about the different types listed in the table above. After that, you can explore the various expression filters.