How to filter data? (Routes & Filters)

Filter data by using routes and filters

There have been some repetitive questions in the community about how you can filter data that comes out of a module, so I will use this topic to combine some Q&A into a small tutorial.

Filtering data allows you to only do specific actions based on a rule you make. For example you can:

  • Only continue if an item exists
  • Only continue if some text contains a certain string
  • Use multiple AND & OR logic to combine multiple statements
  • etc.

To start with this, you need to know what the following things are:

  1. Routes
  2. Filters
  3. Data types

Routes

Routes in Make are simply paths for data to flow within a scenario. Paths can be identified by the dotted line you will see between modules. You can also have multiple routes by using the “Router” module to act on data.

Filters

In Make, filters are used to narrow down data based on specific rules. You can see it as a funnel which has certain holes for specific data.
You can identify filters by the “Filter icon” you will see above a route. If you want to add or edit a filter for a specific route, you can click on the dotted line to open up the “Filter” settings.

Data types

In programming and also in Make, each item of data has a certain data type. You can have strings, objects, arrays, dates etc. which all has a their own set characteristics. More about data types is explained in thist post: Item data types explained.

How to use filters?

As explained above, filters can do all sorts of things depending on what your eventual goal is. You can stop scenarios, continue only with a specific set of data, and so on.

Filters can be set anywhere in the scenario, between modules you want to filter (you don’t need a router module). This means that if you set a filter all the way at the beginning of your scenario, it will filter the data you have at the beginning and only continue the remaining of the scenario with that data.

Filter expression

Data type
When creating a filter you have a whole list of operators to choose from for the expression you would like to make. You are basically creation if / else statements for your data.
When creating a filter, make sure you select the correct operator for your Data Type. If the data you are trying to filter doesn’t match the Data Type operator it might not work properly.

Basic operators
The most basic operators are the

  1. Exists
  2. Does not exist
  3. Is equal to

These are used most of the time and are easy to understand.

1. Exists
The “exists” is basically checking if a certain value is present. If the data is present, it will continue the route and also run the remaining modules. If it’s not present it wil stop (for that specific item) and not continue the remaining modules.

2. Does not exist
The “Does not exist” is the same as the “exists” but the other way around. If the data is not present, it will continue the route and also run the remaining modules. If it is present it wil stop (for that specific item) and not continue the remaining modules.

3. Is equal to
The “equal to” operator is checking if a certain value exactly matches something you place in the filter. This can be usefull when you only want certain items with a specific value to continue.

Using AND & OR to narrow it down
Within filters, you can also use AND / OR operators to narrow down your data further.

When you are using the AND operator, the filter will only continue if ALL expressions within that AND are true. If one of the expressions is not true, it will not continue for that item.

When you are using the OR operator, the filter will check either one of the expressions within the OR rule. If either one of the expressions is true, it will continue for that item.

Creating a filter & running the filter

Once you have created the filter, you want to run the scenario and check the output of the expressions to make sure it’s working like expected.
You can click on the “Zoom” icon within the filter to check the output of it.

make-filter-runscenario

Using Router and Filters for specific actions

Now you understand the basics of filtering data between modules, you can also start using Routers to filter data and run specific modules with only that data.

When setting up a Router, you can create as many routes (or paths) as you like. Each route can have its own filter, and the data that matches that filter will only continue that route. This makes a Router excellent for doing specific actions for only a specific set of data items.

This is the filter for the IT department for example:

Fallback route
When eventually the data has checked all filters of a Router, but does not match anything you can also implement an else expression; this is called a fallback route.

The fallback route will be used for all data, which does not match any of the other routes. This way you can still do something with that data item.
Make sure you set the “fallback route” option to true for that specific route when you want to use this:


Conclusion

I hope all of the information above helps you getting started with filters and routes. Be creative and go do some testing when you get started with this. :smiley:
If you require some assistance feel free to contact us or put down a comment below.

7 Likes

You are an absolute rockstar @Bjorn.drivn :star:

Thank you so much for putting this together, how incredibly helpful!
The community’s gonna benefit from this big time! We’re so lucky to have you :purple_heart:

1 Like

@Bjorn.drivn Wow! Thanks for guide. +1 fan:)

2 Likes

Excellent walk through, I’ll try to link to it when I want someone to read about filtering.

2 Likes

A post was split to a new topic: Setting a filter on a Monday cell being empty

Great guide! @Bjorn.drivn

I’ve only used very simple (1 condition) filters in the past, but have hit an issue with my first filter that uses ‘OR’ operator

I’m using filters for a scenario that creates different user types in Intercom based on their lifecycle stage in HubSpot, where I’ve set the following conditions for router branches.

Update: Solved

Lifecycle stage is not equal to "customer" or "evangelist"

Lifecycle stage is equal to "customer" or "evangelist"

yet, when I test the results show the filter isn’t working as expected — what am I doing wrong?

I also tried with the predefined AND & OR options in the filter menu, same result

Shouldn’t OR evaluate all criteria values, yet it seems that it’s evaluating them individually…

Any guidance would be appreciated, TIA! :v:

2 Likes

Ok, found the solution — just toggled the second branch for everyone that isn’t customer or evangelist as the fallback route :sweat_smile:

I think I got caught in to thinking that OR criterion would be assessed in groups instead of individually/sequentially — as I use a separate traffic distribution platform that has this approach :man_shrugging:t2:

1 Like