Filters

Filters allow you to decide whether or not to run a flow or task depending on whether certain conditions are met (such as if an output value matches a string you provide).

They work differently depending on whether you're filtering a trigger or action:

  • Trigger Filters: You can only filter on outputs from the trigger itself, and if the conditions aren't met, the whole flow won't run.
  • Action Filters: Use any of the outputs from either the trigger or previous actions in your conditions. If conditions aren't met, the single task won't run, but the flow will continue onto the next task.

Adding Filters

You can add filters right after you've chosen the settings for your task (i.e. dragged your outputs on the right into the task's inputs). When you click next, you'll see the Filters step:

Click the Add a Filter button to get going and add your first condition. When a task has a filter, you'll see a small icon against it on the flow builder, like this:

And/Or Conditions

Your filters can be grouped into sets of And or Or conditions, which lets you create all kinds of complex filtering decisions, for example:

Output Types

We'll try to convert types as best we can so that your conditions work as intended.

To explain, if you use the condition Age is greater than 40 and we find that your service has given us Age as text (not a number), we'll convert it to a number so we can work with it.

If we can't evaluate a condition because the types aren't recognisable, we'll consider the condition a non-match. In the example above, if Age contained "foo", we wouldn't be able to decide if "foo" is greater than 40 or not, so we'd assume that it isn't.

Dates and Times

We recognise dates & times in outputs as long as they're in the format:

  • 2015-04-22
  • 2015-04-22T09:00:00
  • 2015-04-22 09:00:00
  • Wednesday, 22 April 2015 (GMT+1)

..or variations on these. If you're familiar with date formats, you'll see that Flow XO can recognise dates in ISO 8601 or the RFC 2822 timestamps format.

When you know you have a recognisable date/time in your output, you can use the condition value like you would a Flow XO special date/time field.

For example, you could use the condition Date is greater than Next Monday. Or Date is less than Tomorrow at 10am.

To filter for a specific day, you may need to use 2 And conditions, such as "Date is greater than 2015-04-22 and Date is less than 2015-04-23". We'll point out some other useful date/time filtering techniques in the Tips section below.

Stop Flow

You'll see an option to Stop flow if conditions are met on action filters. If you select this option, and the action runs (i.e. the filter conditions are met), then the flow will stop there. No other actions will run after it, they'll be ignored.

Custom Outputs

By default, you'll select a single output to filter on from a list. However, you'll see a pencil icon (on the output selection) that switches the select box into a free text entry field which accepts text, outputs, or a combination.

This is especially useful for filtering on values held in data outputs, or for filtering on collections.

Tips

Filter for Days of the Week

As long as the output you're filtering is recognised as a date (see the Dates & Times section above), you can filter using "Date is greater than This Week Monday and Date is less than This Week Saturday" to only match dates from Monday to Friday.

Filter on Time of Day

For outputs recognised as dates/times (see the Dates & Times section above), you can filter using "Date is greater than or equal to Today at 9am and Date is less than Today at 5pm" to only run the flow/task between 9am-5pm.

Using Filters for Conditional Logic/Branching

Flow XO doesn't support 'conditional logic' or 'branching', but it's easy to get the same functionality by using filters.

All you need to do is create 2 tasks, and add filters to match on opposite conditions. For example, use the condition Age is less than or equal to 50 on the first task, and Age is greater than 50 on the second. As long as the filter recognises a number in Age, one of the two tasks will run.

Using Filters to Handle Missing Data

You can also put filters to use helping you deal with data that's sometimes missing. Imagine we have a task that expects the input Phone Number (it's required).

Use the method explained in the tip above ( Using Filters for Conditional Logic/Branching) to match on "Phone Number exists" and "Phone Number does not exist" in two separate tasks. In the first task, we know we have a phone number so we can use it in the input. In the second task, we should use a dummy phone number instead. That way, your flows always work!

Common Problems

  • Be careful when using multiple And conditions against a single output. The filter "Age is equal to 20 and Age is equal to 21" will filter every single task, every time. It's impossible that the same output can equal two different values. You probably want "Age is equal to 20 or Age is equal to 21" instead.
  • If you find your filters never match, it may be because we don't recognise the type (text, number, date, etc.) in either the output or the condition. Take a look at our Output Types section above to learn more.
  • We don't yet support user locale, so all dates/times are taken as UTC. You can use UTC offsets if you like. We aim to support user timezones in the future.

Still need help? Contact Us Contact Us