---
title: TRUNCATE
url: https://www.tines.com/docs/formulas/functions/truncate/
kind: formula-function
---

*[tines.com](https://www.tines.com/llms.txt) › [Docs](https://www.tines.com/docs/llms.txt) › [Formulas](https://www.tines.com/llm/docs/formulas.md) › [Functions](https://www.tines.com/llm/docs/formulas/functions.md)*

# TRUNCATE

*[View on tines.com](https://www.tines.com/docs/formulas/functions/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.

**Categories:** Text

## Syntax

```
TRUNCATE(text, length, [ellipsis])
```

## Examples

### Example 1

Input:

```json
{
  "my_action": {
    "message": "Hello World!"
  }
}
```

Formula:

```
TRUNCATE(my_action.message, 8)
```

Output:

```json
"Hello..."
```

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

Input:

```json
{
  "my_action": {
    "message": "Hello World!"
  }
}
```

Formula:

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

Output:

```json
"Hello etc"
```

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

Input:

```json
{
  "my_action": {
    "message": "Hello World!"
  }
}
```

Formula:

```
TRUNCATE(my_action.message, 5, "")
```

Output:

```json
"Hello"
```

## Sample actions

```json
{
  "standardLibVersion": "14",
  "actionRuntimeVersion": "3",
  "agents": [
    {
      "disabled": false,
      "name": "TRUNCATE",
      "description": "-Truncate will use the assigned path: my_action.example\n\n-then the number is the number of characters (this includes any spaces and punctuation), so on the 29th character it will remove everything that follows\n\n-then it will replace everything that follows with whatever is in quotations, in this case a period \".\"",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "truncate": "=TRUNCATE(my_action.example, 29, \".\")"
        }
      },
      "position": {
        "x": -525,
        "y": 1005
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "My Action",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "example": "Ignore everything after this! and replace with a period"
        }
      },
      "position": {
        "x": -525,
        "y": 885
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    }
  ],
  "links": [
    {
      "sourceIdentifier": 1,
      "receiverIdentifier": 0
    }
  ],
  "diagramNotes": []
}
```
