Get started
Working with Types: Formula, Fields and Values
Segmenting audience using Workflow nodes
Criteria Filter and Criteria Split Workflow Actions
Configuring nodes like Criteria Filter and Criteria Split involves selecting from various data types. This article elucidates these types—formulas, fields, booleans, strings, and numbers—and their application within node configurations.
Configuring criteria conditions
Criteria FilterInsert Definition Here and Criteria SplitInsert Definition Here nodes allows for the configuration of criteria using various data types. 'Field' or 'Formula' can be selected to define the source of the value for comparison, and an appropriate Value is then assigned. An Operator determines the relational condition, such as 'less than' or 'equals'. The type on the right-hand side—be it ‘Field’, ‘Formula’, ‘String’, ‘Number’, or ‘Boolean’—indicates the nature of the comparison parameter, complemented by the corresponding Value input for the condition.
Formula
Formulas allow you to calculate expressions in real-time, when criteria is being evaluated during an experience.Insert Definition Here
Formulas can be entered on the left or right hand side of an operator when the ‘formula’ type is selected. When the formula Value field is selected, a handy formula picker dropdown will appear to help you write formula expressions:
The following formulas and arguments are currently supported:
DateAdd("interval", number, instant)
Returns the result of adding the number of intervals to the given instant (e.g. add 5 days from now). An instant refers to a specific point in time that serves as a reference for calculating timestamps. This could be the current date and time or the start of an experience.
-
interval
— SECONDS, MINUTES, HOURS, DAYS -
number
— The number of intervals to add (e.g. 5). This can be negative. -
instant
— The instant to add to, representing a precise moment in time. This can be the current datetime returned byNow()
or the starting point of an experience returned byExperienceStart()
.
Now()
Returns the current datetime instant
To add 5 days to the current date and time, you would use DateAdd("DAYS", 5, NOW())
. This formula calculates a new datetime that is exactly five days from the exact moment the formula is evaluated.
ExperienceStart()
Returns the instant
the experience started (when the flow triggers for an individual recipient)
If you need to add 10 days to the moment an experience began, such as a user starting a trial or subscription, you would use DateAdd("DAYS", 10, ExperienceStart())
. This helps in scenarios where actions or reminders need to be scheduled based on the start of an experience.
Examples
Use Case | Formula Expression | Operator | Comparison Value | Description |
Follow-up reminder | DateAdd("DAYS", 30, Now()) |
less than or equal to | Current date | Triggers a reminder when the current date is equal to or has surpassed the 30-day follow-up date. |
Subscription renewal | DateAdd("DAYS", -10, ExperienceStart()) |
greater than or equal to | Subscription expiry date | Initiates a renewal reminder when the current date is within 10 days before the subscription expiry date. |
Post-trial engagement | DateAdd("DAYS", 14, ExperienceStart()) |
equal to | Trial end date | Engages users 14 days after their trial started, aligning with the trial end date for follow-up actions. |
Offer expiration | DateAdd("HOURS", -24, Now()) |
less than or equal to | Offer expiry date | Checks if an offer expired within the last 24 hours, potentially to offer an extension. |
Membership anniversary | DateAdd("YEARS", 1, ExperienceStart()) |
equal to | Current date | Annually checks if today matches the anniversary of the membership start date to trigger celebratory or renewal actions. |
Field
The Field
type allows referencing data directly from fields stored in your system, similar to how merge fields work. Begin typing in the input to search and select from available fields, which dynamically populate based on your system's data schema.
For example, using the field City
from your system of record, you could use the field type and add a value (for instance, Sydney
) to filter recipients based on whether their city is Sydney or not.
String
The String
type is used for text comparisons. Each character in the text is compared one at a time.
For example, you can specify exact text to match against a field's value. For instance, the City
field might be paired with the string value Sydney
to target users specifically in that city.
When using operators like "greater than" or "less than" in string comparisons, the order may not be what you expect. For example, "2"
is greater than "11"
, and "Cat"
is less than "catalog"
because uppercase letters sort before lowercase.
Boolean
The Boolean
type supports true or false values, making it ideal for fields that store binary data, such as isActive
or emailVerified
. This type is essential for filtering recipients based on Boolean field conditions.
Number
The Number
type is utilised for numerical comparisons and can be used with fields that store numeric values, such as age, quantity, or thresholds. For example, setting a Number
type to 1234
allows you to target recipients based on numeric criteria like account numbers or identifiers.
Usage scenario: Offer expiry example
As an example, we can use Criteria filter to create an offer expiry period in the flow.
When a recipient replies to the original outbound SMS, the reply will come back into Pendula, and the split will check whether it was received before the expiry - i.e. was it received 2 days before or 2 days after the original messages sent?
In the criteria builder:
-
LHS Select type =
formula
-
Enter the formula =
DateAdd ("DAYS", 2, ExperienceStart())
(2 days from when the experience started)
-
Select operator =
less than
-
RHS Select type =
formula
-
Enter the formula
Now()
Essentially this checks that the inbound message was received less than 2 days ago and the recipient has replied, they can continue through the the ‘success’ path of the split.