Filters

Prefer a step-by-step guide? Try our  filters tutorial.

Filters allow you to decide whether or not to run a trigger or action depending on whether certain conditions are met (such as if a value is a match for another value).

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 action won't run, but the flow will continue onto the next action.

Adding Filters

You can add filters right after you've chosen the settings for your trigger/action. 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 trigger/action has a filter, you'll see a small icon against it on the flow builder, like this:

Using Outputs

A filter condition has either one or two value fields, and the condition itself (such as 'equals').

The value fields work like other fields in Flow XO that can contain either fixed text or you can type {{ or click the Flow XO icon to insert outputs from the trigger or previous actions.

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:

'Equals one of' Condition

This will match a single string (first value field) against a list of comma-separated values (second value field) for a match. Each value will be trimmed of whitespace and lowercased before being matched with the comparison value.

For example, you might match 'foo' against 'foo, bar, baz' (match). Or 'foo' against 'FOO, bar, baz' (match).

Type Comparisons

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 the first value field of the condition as long as they're in the format:

  • 2017-04-22
  • 2017-04-22T09:00:00
  • 2017-04-22 09:00:00
  • Monday, 22 April 2017 (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 format or as RFC 2822 timestamps.

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

For example, you could use the condition '2017-04-22 is greater than next Monday', or '2017-04-22 12:00:00 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.

Timezones

Dates and times are processed in the timezone set up in your account (in your profile).

Be careful when using date conditions like '(date) is greater than today' or '(date) is less than tomorrow at 10am' if using a date including a timezone. If 'date' contains an explicit timezone or offset, the condition will only work as expected if it matches the timezone set in your account. That's because 'today' or 'tomorrow at 10am' is processed in your account timezone.

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.

Tips

Filter for Days of the Week

As long as the value you're filtering is recognised as a date (see the Dates & Times section above), you can filter using '(date) equals weekday' to only match dates from Monday to Friday. You could use conditions like '(date) equals weekend', '(date) equals Tuesday' or '(date) equals one of Mon, Tue'.

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 trigger/action between 9am-5pm.

Using Filters to Choose Between 2 Actions

To have one of 2 actions run depending on conditions, all you need to do is create 2 actions, and add filters to match on opposite conditions. For example, use the condition '(age) is less than or equal to 50' on the first action, and '(age) is greater than 50' on the second. One of the two actions 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 an action that expects the input 'phone number' (it's required).

Use the method explained in the tip above ( Using Filters to Choose Between 2 Actions) to match on 'phone number exists' and 'phone number does not exist' in two separate actions. In the first action, we know we have a phone number so we can use it in the input. In the second action, 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 value. The filter '(age) is equal to 20 and (age) is equal to 21' will filter every single action, every time. It's impossible that the same value can equal two different things! 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..). Take a look at our Output Types section above to learn more.
  • Avoid using dates that include a timezone or offset when using conditions like '(date) is greater than today'. Dates should be ambiguous for this to work properly, or any timezone or offset given in the date should match the account's timezone setting.
  • When using the Equals one of or Does not equal one of filters, these look for an exact match to a string. The string values can't include spaces. so you'd need to use for instance Equals One Of option1,option2,option3 rather than Equals One Of option 1,option 2,option 3.

Still need help? Contact Us Contact Us