1. Docs
  2. Formulas
  3. Functions

IF

If condition is TRUE returns second argument, if FALSE returns null or the third argument.

Categories: Logic

Syntax

IF(condition, value_if_true, [value_if_false])

Examples

Example 1

Input

1
{
2
"my_action": {
3
"value": 5
4
}
5
}

Formula

IF(my_action.value>5, "true")

Output

null

Example 2

Input

1
{
2
"my_action": {
3
"value": 5
4
}
5
}

Formula

IF(my_action.value>5, "true", "false")

Output

false

Example 3

Input

1
{
2
"my_action": {
3
"value": 5
4
}
5
}

Formula

IF(my_action.value>1, "true", "false")

Output

true

Example 4

Input

1
{
2
"my_action": {
3
"value1": 5,
4
"value2": 50
5
}
6
}

Formula

IF(AND(my_action.value1<my_action.value2, my_action.value<100), my_action.value1, "Value is not within the range")

Output

5

Example 5

Input

1
{
2
"my_action": {
3
"value1": 500,
4
"value2": 50
5
}
6
}

Formula

IF(AND(my_action.value1<my_action.value2, my_action.value<100), my_action.value1, "Value is not within the range")

Output

"Value is not within the range"

Sample actions

Event Transform
IF
Event Transform
My Action

Select an action to inspect

You can also click "Copy actions" and paste them in your Tines story to see how they work.

Was this helpful?