CLAMP

Restricts a given value to a specific range defined by a minimum and a maximum boundary. If the input value is lower than the minimum, the function returns the minimum. If it is higher than the maximum, it returns the maximum. Otherwise, it returns the input value itself. For string inputs, CLAMP uses lexicographical sort order.

Syntax 

CLAMP(input, min, max)

Usage examples 

Example 1

Input

1
{
2
"my_action": {
3
"input": -10
4
}
5
}

Formula

CLAMP(my_action.input, 0, 100)

Output

0

Example 2

Input

1
{
2
"my_action": {
3
"input": "blue"
4
}
5
}

Formula

CLAMP(my_action.input, "amber", "green")

Output

"blue"

Sample Actions 

Event Transform
CLAMP
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?