---
title: SLICE
url: https://www.tines.com/docs/formulas/functions/slice/
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)*

# SLICE

*[View on tines.com](https://www.tines.com/docs/formulas/functions/slice/)*

Returns 1 or `length` characters from a piece of text, beginning at the `start_index`.

**Categories:** Text

## Syntax

```
SLICE(text, start_index, [length])
```

## Examples

### Example 1

Input:

```json
{
  "my_action": {
    "message": "hello world"
  }
}
```

Formula:

```
SLICE(my_action.message, 6)
```

Output:

```json
"w"
```

### Example 2

Input:

```json
{
  "my_action": {
    "message": "hello world"
  }
}
```

Formula:

```
SLICE(my_action.message, 6, 5)
```

Output:

```json
"world"
```

### Example 3: If `length` extends past the end of the piece of text, it returns only the remainder of the text:

Input:

```json
{
  "my_action": {
    "message": "hello world"
  }
}
```

Formula:

```
SLICE(my_action.message, 6, 50)
```

Output:

```json
"world"
```

### Example 4: `start_index` can be specified as a negative number to count back from the end of the piece of text:

Input:

```json
{
  "my_action": {
    "message": "hello world"
  }
}
```

Formula:

```
SLICE(my_action.message, -5, 5)
```

Output:

```json
"world"
```

## Sample actions

```json
{
  "standardLibVersion": "14",
  "actionRuntimeVersion": "3",
  "agents": [
    {
      "disabled": false,
      "name": "My Action",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "message": "hello world"
        }
      },
      "position": {
        "x": 2790,
        "y": 4755
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "SLICE",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "slice": "=SLICE(my_action.message, 6)"
        }
      },
      "position": {
        "x": 2565,
        "y": 4860
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "SLICE",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "slice": "=SLICE(my_action.message, 6, 5)"
        }
      },
      "position": {
        "x": 2715,
        "y": 4860
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "SLICE",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "slice": "=SLICE(my_action.message, 6, 50)"
        }
      },
      "position": {
        "x": 2865,
        "y": 4860
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "SLICE",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "slice": "=SLICE(my_action.message, -5, 5)"
        }
      },
      "position": {
        "x": 3015,
        "y": 4860
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    }
  ],
  "links": [
    {
      "sourceIdentifier": 0,
      "receiverIdentifier": 1
    },
    {
      "sourceIdentifier": 0,
      "receiverIdentifier": 2
    },
    {
      "sourceIdentifier": 0,
      "receiverIdentifier": 3
    },
    {
      "sourceIdentifier": 0,
      "receiverIdentifier": 4
    }
  ],
  "diagramNotes": []
}
```
