Locoia
Search…
Boolean Helper
Making decisions based on comparing data

Introduction

Often times, you want to make a decision based on data you got in a previous step. This can be done with the Boolean Helper. Comparison types like greater, smaller, etc. are explained below.
In the screenshot below, you see a typical example of where and how to use a boolean helper:
To get started, simply enter the data value you want to compare to in Value A and the to be compared with value in Value B. As for the Comparison Type select the one that suits your use-case. The boolean helper fully supports our Jinja2 syntax, so you can dynamically insert values for comparison.
Note: you can either select two relative values in Value A and Value B, meaning you can reference data from a previous step of the automation flow, or you can enter static data. E.g. in the example screenshot above, you can see Value A is a relative reference to a previous step indicated by the Jinja parenthesis {{ }}. Value B on the other hand, has just the word "true" which is static and not a reference. In total you can have these combinations:
Value A
Value B
Common example
{{ reference }}
{{ reference }}
Compare whether the new data matches the existing data, e.g. to check whether a CRM System needs to be updated.
{{ reference }}
static
Check whether a user's property is equal to a set value. For example, test if a user is part of a specific customer group.
static
{{ reference }}
The same as line two so not really needed.
static
static
This can be convenient to add manual gates into your flows. For example, you might want to send out emails to customers, but only once your Flow is live, and not for testing. So you can compare True to False, which will make the flow end at the boolean helper if nothing is connected to the false arrow.

Comparison types of the boolean helpers

The boolean helper has many comparison types for values:
  • greater - can be applied to any number or datetime format
  • smaller - can be applied to any number or datetime format
  • equal - can be applied to any number or datetime format
  • greater_equal - can be applied to any number or datetime format
  • string_is - can be applied to any string
  • string_begins - can be applied to any string
  • string_ends - can be applied to any string
  • string_includes - can be applied to any string (not visible on the screenshot below, but is in the app)
Screenshot from the app:

Boolean helpers in Loops

Boolean helpers are often used as part of loops, when there is a larger list, dict or array of data, where each data record has a particular information based on which the boolean helper can take a decision and do something.

Example

Let's suppose you have a list of users how contacted you on your website and depending on whether they already exist, you want to send a different email to them:

Advanced Data Comparison

Thanks to Jinja, you are able to do a lot of different data comparisons with the boolean helper. Let's go over a few of them:

Length of a list

To figure out the length of a list, you can use the Jinja Builtin Filter | length:
{{ my_list | length }} will return the length of a list. An empty list will always have a length of 0. So by comparing the length against a number of you choosing, you can either ensure that a list has at least one entry (>0), or that it meets a specific length requirement you have.

Checking if a string is empty

If you like to check whether a variable returns an empty string, you have to set Value B to {{ "" }}. In this example it is checked that a my_variable is not an empty string. If my_variable is an empty string it will return false.

Checking that a variable is defined

{{ my_variable is defined }} will return either True or False, which you can compare against by using the "equal" comparison type.

Checking that multiple variables are defined

You can chain multiple tests together in a single Jinja statement and return some conditional value. If you want to check that, for example, 2 of your variables are defined before the flow proceeds, you can use the following statement:
{% if var1 is defined and var2 is defined %}True{% else %}False{% endif %}
Then simply compare against True with the equal comparison, and you flow will only go along the TRUE arrow when both values are defined.