Basic operator “exists”

:bullseye: What is your goal?

Check if data exists

:thinking: What is the problem & what have you tried?

Can not find the “exists” basic operator

Hey Brandon,

in a filter or when mapping something? The function is called ifempty(), checks if the mapped value exists and allows you to specify a replacement value if it doesn’t.

Hello Brandon,

Welcome to the Community!

Please let us know what you want to achieve by filtering. There can be different approaches to efficiently solve your problem.

There is no native “Exists” operator. If you want to process data differently based on the existence of a value, you should use the Router module and configure routes properly.

If there is no need to differentiate- for example, if you are using non-trigger modules as your starting module in a scenario - simply configure the filter.

Learn more about filters: Filtering - Help Center

Welcome to the Make community!

Exists vs “Has Value”

A variable existing and having a value have different meanings depending on the context. A variable can exist and have a value, or exist but not have a value. I am guessing you likely want to check if a variable contains a valid value (something that isn’t null, undefined, empty, or of zero-length for strings/arrays).

Checking if a variable has a value

Here are some common ways to check if a variable contains a value (NOT null, undefined, empty, or of zero-length for strings/arrays). This list is non-exhaustive, as there are many more ways to do it.

1. Use the ifempty() function:

This falls back to the second parameter if the first parameter is null, empty (zero-length), or undefined.

:clipboard: Note: :light_bulb:
The second parameter is optional, you can leave it blank if you don’t want to do anything if the first is null, empty (zero-length), or undefined. i.e.:

2. Use the if() and length() functions:

  • if
    if(expression; value1; value2)

  • length
    length(text or buffer)

Here’s an example of how you can use these functions together:
{{ if(length(text) > 0; value1; value2) }}

:clipboard: Note: :light_bulb:
The second parameter is optional, you can leave it blank if you don’t want to do anything if the first is null, empty (zero-length), or undefined. i.e.:

3. Use a filter

You can use a filter before the module to pass / continue only if the variable contains a value that you are expecting.

3A. Length greater than zero

This checks if the length of the string or array contains at least one character or item.

3B. Not empty string

This checks if the string exists and is not an empty (of zero-length) string "".

3C. Using the “Exists” operator in filters :red_question_mark::red_question_mark:

In most cases, this may seem to work just fine, especially for strings of zero-length, and it does not “pass” (let the bundle through) when the variable contains no value / an empty string.

This is because the “Exists” filter operator is a simple boolean (true or false) check. What happens behind the scenes is something called “Type Coercion” — when one value needs to be converted into another type. The variable needs to be converted into a boolean (true or false) before the computer language/code knows whether it “Exists” (true), or “Does not exist” (false).

Hence, it may not work as you expect it to work the way you need it to, as the converted variable may not return the boolean value you expect. For more information, see Type coercion in the Make Help Centre.


You can possibly learn more about this in these Make Academy units:

Expanding my first scenario

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

An introduction to data types and data structures

  • A brief introduction to Data Types
  • How to map Data Items
  • An introduction to Collections and Arrays

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!