Conditional Logic

Conditional logic allows you to add your own logic to the app. This is helpful when you want to display something or set a value from a variable based on a certain condition(s). For example, displaying subscribe button only if the user is logged in and not already subscribed. Another example is showing discount coupon values based on previously purchased items.

You can add conditional logic using a single condition or multiple conditions (AND or OR) and use the conditional value using the If/then/else flow.

Single condition

Using this, you can define a single condition based on two values. You can set these two values either manually or from a variable. This can return True or False (based on the condition).

While adding a condition, you can specify how to compare two values using any of the following options:

  • Equal To

  • Not Equal To

  • Less Than

  • Greater Than

  • Less Than Or Equal To

  • Great Than Or Equal To

  • Is Set

  • Is Not Set

To add a single condition:

  1. From the Set from Variable menu, select Conditions > Single Condition.

  2. Click on the First Value and select the Source (e.g., app state variable).

  3. Specify how you would like to compare the first value with the second one (e.g., Equal To, Less Than).

  4. Click on the Second Value and provide the value by selecting a Specific Value or From Variable.


Multiple conditions (AND/OR)

Using this, you can add multiple single conditions using AND/OR. For example, on the EventDetails page, you might want to display the edit button only if the current user created the event AND when the edit mode is off.

To add multiple conditions:

  1. From the Set from Variable menu, select Conditions > Combine Conditions.

  2. Under the First Condition, click on UNSET and add the single condition or directly provide the variable that returns a boolean value (True/False).

  3. If you want all the conditions to be true, keep the AND tab selected. And if you want any one condition to be true, change it to OR.

  4. Similarly, add the next condition.

  5. To add more conditions, click on the + Add button.

You can also mix multiple AND conditions with the OR conditions. Here is an example of displaying the delete button when a user is either admin OR event manager AND is logged in.


Conditional value (If/then/else)

Conditional Value allows you to provide the dynamic variable based on different conditions (either single or multiple). For every condition, you can provide a variable that will be set if the condition is true. You can also specify a default variable in case all the condition fails.

For example, display different temperature colors based on different values (i.e., show blue color when the temperature is less than 0, show orange color when the temperature is less than 28; otherwise, show red color).

To add conditional value:

  1. From the Set from Variable menu, select Conditional Value.

  2. Under the First Condition, provide the IF condition by clicking on UNSET.

  3. Now, besides the THEN, click Set from Variable and provide the source that will be set if the first condition is true.

  4. If the first condition fails, provide another one by clicking on the + button.

  5. If all the above conditions fail, provide the variable inside the last Else section.

  6. In case the returning type is different, set it from the Return Type section.

  7. If the final result is null or empty, you can specify the Default Variable Value.


Last Updated Date: October 9, 2023

Last updated