TRUNCATE

Shorten text down to the number of characters passed as a parameter.

If the number of characters specified is less than the length of the text, ... is appended to the text and is included in the character count.

Syntax 

TRUNCATE(text, length, [ellipsis])

Usage examples 

Example 1

Input

1
{
2
"my_action": {
3
"message": "Hello World!"
4
}
5
}

Formula

TRUNCATE(my_action.message, 8)

Output

"Hello..."

Example 2

An optional third argument controls the characters inserted if the text is truncated (instead of ...):

Input

1
{
2
"my_action": {
3
"message": "Hello World!"
4
}
5
}

Formula

TRUNCATE(my_action.message, 9, " etc")

Output

"Hello etc"

Example 3

Setting the third argument to "" prevents any text being inserted if the text is truncated:

Input

1
{
2
"my_action": {
3
"message": "Hello World!"
4
}
5
}

Formula

TRUNCATE(my_action.message, 5, "")

Output

"Hello"

Sample Actions 

Event transform
TRUNCATE
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?