DEFAULT
Allows you to specify a fallback in case a value doesn’t exist.
Returns the fallback value if the input is null, false, or an empty text value, array, or object. When every argument is empty, the first fallback is returned by default. Pass {use_last_fallback: TRUE} as the final argument to return the last fallback instead.
Categories: Logic, Arrays, Text
Syntax
DEFAULT(value, fallback1, fallback2, ..., [{use_last_fallback: FALSE}])
Examples
Example 1
Input
1
{
2
"my_action": {
3
"message": []
4
}
5
}
Formula
DEFAULT(my_action.message, "fallback")
Output
"fallback"
Example 2
Input
1
{
2
"my_action": {
3
"message": [
4
1
5
]
6
}
7
}
Formula
DEFAULT(my_action.message, "fallback")
Output
1
[
2
1
3
]
Example 3
Input
1
{
2
"my_action": {
3
"message": ""
4
}
5
}
Formula
DEFAULT(my_action.message, "fallback")
Output
"fallback"
Example 4
Input
1
{
2
"my_action": {
3
"message": "hello world"
4
}
5
}
Formula
DEFAULT(my_action.message, "fallback")
Output
"hello world"
Example 5
Input
1
{
2
"my_action": {
3
"message": "hello world"
4
}
5
}
Formula
DEFAULT(my_action.does_not_exist, "fallback")
Output
"fallback"
Example 6
Input
1
{
2
"my_action": {
3
"message": false
4
}
5
}
Formula
DEFAULT(my_action.message, "fallback")
Output
"fallback"
Example 7
Input
1
{
2
"my_action": {
3
"message": [],
4
"fallback": ""
5
}
6
}
Formula
DEFAULT(my_action.message, my_action.fallback, "fallback")
Output
"fallback"
Example 8
Input
1
{
2
"my_action": {
3
"message": [],
4
"first_ref": null,
5
"second_ref": []
6
}
7
}
Formula
DEFAULT(my_action.message, my_action.first_ref, my_action.second_ref)
Output
null
Example 9
Input
1
{
2
"my_action": {
3
"message": [],
4
"first_ref": null,
5
"second_ref": []
6
}
7
}
Formula
DEFAULT(my_action.message, my_action.first_ref, my_action.second_ref, {use_last_fallback: TRUE})
Output
[]
Sample actions
Select an action to inspect
You can also click "Copy actions" and paste them in your Tines story to see how they work.