Skip to content
On this page

Filter steps

Filters determine if a workflow continues executing steps or stops. A filter step contains one or many filter groups of which at least one group needs to evaluate to be true for the workflow to continue executing. Each filter group contains one or many individual conditions that all must evaluate to be true for the entire group to pass.

A filter step can be made up of a single conditional that simply evaluates to true or false and either allows the workflow to continue or not. A filter step can also be a complex series of AND and OR conditions.

Single filter group

The simplest possible filter step only evaluates one single condition to either true or false. This example checks if the title of a post object contains the word "WunderAutomation" and will only let the workflow continue if that condition is satisfied.

image-20221016211451494

A slightly more advanced filter could include two conditions for the entire filter step to pass. By clicking the plus (+) sign at the right of the filter condition, a second condition can be added:

image-20221016212241154

With this new condition added, not only does the post title need to contain the word "WunderAutomation", but the post content also needs to contain the word "version". Both these two conditions need to be true and that is why the word "AND" is shown between the two rows of conditions.

These two conditions are part of the same group. All conditions that are added to the same group are required to be true for the entire group to pass as true. They are combined with logical AND operators.

Multiple groups

Sometimes it's needed to create a filter step that passes if one or the other condition is true, to combine conditions using a logical OR. This is possible by adding a second filter group. Let's assume that in the above example we wanted the filter step to pass either if the post title contains the word "WunderAutomation" OR if the post content contains the word "version".

To do this, we click the Add filter group button to add an OR condition:

screenshot showing two filter groups - WunderAutomation

Now, these two conditions are each part of different groups and it's enough for any group to pass as true for the entire step to pass as true and allow the workflow execution to continue.

Complex filter steps

It's possible to combine AND and OR conditions however needed to get the desired effect on the workflow execution. As long as at least one filter group evaluate to be true, the workflow will continue:

screenshot showing multiple filter groups - WunderAutomation

Using multiple filter steps

In some cases using a single filter step to express all conditions may lead to a lot of repetition. A pretty common example is that you want the workflow to run if the post object has the post type "page" AND if either the post title OR the post content contains a certain word. To express this condition in a single filter step would require the check for post type to be in both filter groups which would make it a little bit clumsy.

A better way of expressing this is to use two filter steps. The first step uses a single filter group and checks the post type condition. The second step uses two filter groups that check the post title and content respectively.

Screenshot showing two filter steps to simplify writing conditions - WunderAutomation

Comparison operators

Each filter condition operates on a specific property (or parameter) on a runtime context object. Depending on the data type of the object, different operators become available.

String operators

A lot of object properties are in the form of a string. String values can be compared using the following operators:

OperatorDescription
EqualsThe two values are the same
Does not equalThe two values are not the same
ContainsThe parameter contains the second operator value
Does not containThe parameter does not contain the second operator value
Starts withThe parameter starts with the second operator value
Ends withThe parameter ends with the second operator value
Is emptyThe parameter is empty
Is not emptyThe parameter is not empty
Greater than or equalsIf interpreted as a numeric value, the parameter is greater than or equal to the second operator value
Lower than or equalsIf interpreted as a numeric value, the parameter is lower than or equal to the second operator value
Is one ofThe second operator is interpreted as a comma separated list and the object parameter equals one of these values.
Is not one ofThe second operator is interpreted as a comma separated list and the object parameter doesn't equal any of these values.

Date operators

Some object properties represent dates, such as a user registration date or the publish date of a post.

OperatorDescription
Is beforeThe object parameter (date) is before the second operator value
Is afterThe object parameter (date) is after the second operator value
Is emptyThe object parameter (date) is empty

Numerical operators

Some object properties represent numerical values, such as an order total amount or a user login count.

OperatorDescription
EqualsThe two values are the same
Not equalsThe two values are not the same
Greater than or equalsThe parameter is greater than or equal to the second operator value
Lower than or equalsThe parameter is lower than or equal to the second operator value

Set operators

Some object properties have a distinct value from a set of possible values. For instance, a post status can (should) only have the value of any of the defined post statuses of your WordPress site.

image-20221016222642676

When these object properties are used in a filter, the operators used are set operators:

OperatorDescription
Is one ofThe object parameter equals one of the listed values
Is not one ofThe object parameter does not equal one of the listed values

Many to many set operators

Some object properties have zero, one or multiple possible values. For instance, a post may have zero, one or many tags and categories. To compare these properties in a filter condition, WunderAutomation uses many to many set operators.

image-20221016223121387

These object properties are compared using many-to-many operators:

OperatorDescription
Contains anyThe object property set has at least one value represented in the list of values in the second operator
Contains allThe object property set has all values represented in the list of values in the second operator
Contains noneThe object property set has none of the values represented in the list of values in the second operator

Released under the MIT License.