TRUNCATEWORDS

Shortens text down to the number of words passed as the argument.

Syntax 

TRUNCATEWORDS(text, length, [ellipsis])

Examples 

Example 1

Input

{
  "my_action": {
    "message": "Hello and welcome to Tines"
  }
}

Formula

TRUNCATEWORDS(my_action.message, 3)

Output

"Hello and welcome..."
Example 2

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

Input

{
  "my_action": {
    "message": "Hello and welcome to Tines"
  }
}

Formula

TRUNCATEWORDS(my_action.message, 3, " etc")

Output

"Hello and welcome etc"
Example 3

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

Input

{
  "my_action": {
    "message": "Hello and welcome to Tines"
  }
}

Formula

TRUNCATEWORDS(my_action.message, 3, "")

Output

"Hello and welcome"