Skip to content

Updating visuals

If you see any images containing outdated UI, please bear with us.

We are updating all content as quickly as possible to mirror our new UI.

Conditional formulas ​

Conditional formulas are a way to test for truthiness or falsiness of variables or comparisons and return a different value according to this.

if ​

if takes 3 arguments, in order:

  • condition The variable or comparison to test truthiness on
  • value1 The value to return if the condition is truthy
  • value2 The value to return if the condition is falsy

Example ​

Here, we're using the if formula with a variable (display modal) as a condition. The formula will test if the varibale is true, and because it's false in this case, it'll return the second value.

ifEmpty ​

Use case ​

The ifEmpty formula is used to check if a given value is empty or not.

If the value is empty, it returns a fallback value you choose. If the value is not empty, it returns the original value — or a different value when you use the optional third parameter.

Syntax ​

ifEmpty takes two or three arguments, in order:

  • value — The value you want to check
  • fallback — The value to return if value is empty
  • valueIfNotEmpty (Optional) — the value to return if value is not empty. If you omit this, the formula returns value.

Examples ​

To check if user_input is empty and return "Default Value" when it is:

ifEmpty(user_input, "Default Value")

  • If user_input has a value, the formula returns that value.
  • If it is empty, it returns "Default Value".

To return a different value when user_input is not empty, add a third parameter:

ifEmpty(user_input, "Default Value", "You entered: " + user_input)

  • If user_input is empty, it returns "Default Value".
  • If it has a value, it returns "You entered: " followed by what the user typed.

Here's the ifEmpty formula in action to check if a table view has returned items or not:

ifEmpty formula in action

not ​

The not formula takes a variable or camparison, and return the opposite boolean value.

Ok, so what does it means? 😆

If a variable or comparison is truthy, it will return false. If a variable or comparison is falsy, it will return true.

So, this formula is useful when you need to invert a condition.

Example ​

In this example, we apply not to the display modal from before, which is false. So the return value is true.

If we take back the example from the if formula, it will now return the first value as the comparison is now not(false), so true.

switch ​

The switch formula takes an expression, then checks its equality with each value and return the matching result.

Example ​

Here, switch takes the variable user location as a an expression, which equals to "USA". It'll then loop over values, match the one which equals "USA" too, and return the matching value, which is Hello from the US 👋".