How to Simplify Multiple Filters Combining AND & OR?

:bullseye: What is your goal?

Using AND in a filter after adding a number of OR conditions.

:thinking: What is the problem?

If I’m adding an AND condition after a series of OR conditions does the AND condition only affect the last OR condition I created or all OR conditions?

I want to pass ‘Armstrong’, ‘Aldrin’, and ‘Collins’, but I don’t want to include ‘timeline’, ‘launch’, or ‘landing’.

Should it be
Armstrong
OR
Aldrin
OR
Collins
AND
Timeline
AND
launch
AND
landing

Welcome to the Make community!

In general, you will want to entirely AVOID using OR conditions, or AVOID mixing OR with AND conditions, because “OR” conditions create a new group of filter conditions. When that happens, you will then have to repeat similar filters across all the groups.

May I suggest using “Text Operators: Matches Pattern”, or “Array Operators: Array Contains” instead? This way, we can eliminate the use of “OR”.

Make Academy

You can learn more about filters in these Make Academy units:

Expanding my first scenario

  • Adding a Router
  • Adding a Filter
  • More options with Filters
  • Overview of scheduling
  • Run once

Hope this helps! If you are still having trouble, please provide more details.

@samliew
P.S.: investing some effort into the tutorials in the Make Academy will save you lots of time and frustration using Make!

2 Likes

It affects only the last OR condition.

To achieve your goal, you’ll need to group them like so:

Equals Collins and not equal timeline and not equal launch and not equal landing
OR
Equals Armstrong and not equal timeline and not equal launch and not equal landing
OR
Equals Aldrin and not equal timeline and not equal launch and not equal landing

You can also use more advanced methods like samliew suggested.

Thanks for the response.
I want to use Matched pattern, but I don’t understand the syntax (pipe symbols, dollar signs, etc) and can find no help as to why it is written like this. Can you assist or point me to a resource?

Sorry if this seems basic, but brand new to all of this.

1 Like

Hello,

What is a “Pattern”?

When you see the word “Pattern” in Make, it most likely refers to a Regular Expression (pattern).

Regular expressions is something you’ll have to learn and practice to get better at, and you aren’t expected to know how to use it within Make. However, it is a very powerful and useful tool as you can possibly easily reduce lots of operations into a single operation within your scenarios. For example, instead of “looping” through arrays with Iterators and Filters, we can convert it into a single text variable before extracting data in a single operation.

To answer your last question, a good resource you will definitely need to use to build and have individual parts of the regular expression broken down and explained, is to use the online tool Regex101.com.

Quick Guide on How to Use Regex101.com

  • Top: Paste in the regular expression pattern
  • Below: Paste a complete/full example text you are trying to match from
  • Select: “ECMAScript” from the left sidebar

  • Right: Explanation of what the pattern does
  • Bottom Right: Preview of matches from the example text

:clipboard: Note: :light_bulb:
Using regex101 will allow you to verify that the pattern is working correctly, before you use it in Make.

Learning & Using Advanced Regular Expressions

Within Make’s documentation, it isn’t mentioned much, and I could only find a reference here Text parser - Help Center, which says:

The search pattern is a regular expression (aka regex or regexp), which is a sequence of characters in which each character is either a metacharacter, having a special meaning, or a regular character that has a literal meaning.

source

You can also learn more about regular expression patterns by searching the internet, which has hundreds and thousands of tutorials, courses, & videos.

Get Expert Advice

If you require an expert to help you look at your scenario to see if regular expressions can be used to reduce the complexity and number of operations in your scenario, please use the Hire a Pro > Hire Help category. For example, instead of “looping” through arrays with Iterators and Filters, we can convert it into a single text variable before extracting data in a single operation.

It is important to post your request in the Hire a Pro > Hire Help category, as other forum members are not allowed to advertise services in other categories like here. Posting in the Hire a Pro > Hire Help category will also expedite your request as other members can assist you over other forms of communication like direct messages, emails, and screenshare.

How to send direct messages?

This forum has a semi-hidden messaging feature which you can use to directly reach out to other forum members.

:warning: Warning: :police_car_light:
New forum accounts do not have permissions to send private messages. Simply earn trust levels first by being active on this forum

1. Message Inbox Page

You can message another user from your message inbox page, and click on the “New Message” button on the right.

2. User Card / Profile Pages

You can message another user from their profile card on each post, or visit their profile.

3. Creating a New Topic

The last method is by using the “New Topic” button to begin composing a new topic. Click on the :plus: symbol to switch the post type to a “New message”.

If you have a follow-up question, please start a new thread. Thanks!

@samliew

Glad I could help with your question:
"Using AND in filters"   :tada:

1. Which was the most helpful post in this thread?

The Make Community guidelines encourages users to try to mark helpful replies as solutions to help keep this forum organised. :folded_hands:

This marks the topic as solved, so that others can:

  • save time when browsing the latest activity on the forum, and
  • quickly jump to the solution in this topic (from the top)

To do this, simply click the checkbox at the bottom of the post that is the most helpful in answering your question.

a screenshot of post menu options at the bottom of each post
:link: Here’s a magic link to a list of your other “unsolved” topics— status:unsolved

2. Have you learnt something new?

Do bookmark this topic so you can easily find and return to this topic in future.
a screenshot of bookmark link at the bottom of the topic

:link: Here’s a magic link to a list of your bookmarks— /my/activity/bookmarks

3. Have a different question? Start a new topic.

Do you have a question that is not about "Using AND in filters"? Please start a new topic.

Creating a separate topic for each question makes it easier for others with the same problem to search for answers. You are also more likely to receive help sooner as new topics are displayed first on the forum’s “new” page!

@samliew