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

# REVERSE

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

Reverses the order of the elements in an array. Please note, this operation will recursively flatten arrays and directly nested arrays, then reverse the final array.

**Categories:** Arrays

## Syntax

```
REVERSE(array)
```

## Examples

### Example 1

Input:

```json
{
  "my_action": {
    "message": [
      "north",
      "south",
      "east",
      "west"
    ]
  }
}
```

Formula:

```
REVERSE(my_action.message)
```

Output:

```json
[
  "west",
  "east",
  "south",
  "north"
]
```

### Example 2: REVERSE can't directly reverse an individual piece of text, but you can combine it with SPLIT and JOIN to make it work:

Input:

```json
{
  "my_action": {
    "message": "edit maps"
  }
}
```

Formula:

```
JOIN(REVERSE(SPLIT(my_action.message, "")), "")
```

Output:

```json
"spam tide"
```

### Example 3: REVERSE also flattens arrays

Input:

```json
{
  "my_action": {
    "message": [
      [
        1,
        2,
        3
      ],
      [
        4,
        5,
        6
      ],
      [
        7,
        8,
        9
      ]
    ]
  }
}
```

Formula:

```
REVERSE(my_action.message)
```

Output:

```json
[
  9,
  8,
  7,
  6,
  5,
  4,
  3,
  2,
  1
]
```

## Sample actions

### Sample action 1

```json
{
  "standardLibVersion": "14",
  "actionRuntimeVersion": "3",
  "agents": [
    {
      "disabled": false,
      "name": "My Action",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "message": [
            "north",
            "south",
            "east",
            "west"
          ]
        }
      },
      "position": {
        "x": 2955,
        "y": 4455
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "REVERSE",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "reverse": "=REVERSE(my_action.message)"
        }
      },
      "position": {
        "x": 2955,
        "y": 4560
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    }
  ],
  "links": [
    {
      "sourceIdentifier": 0,
      "receiverIdentifier": 1
    }
  ],
  "diagramNotes": []
}
```

### Sample action 2

```json
{
  "standardLibVersion": "14",
  "actionRuntimeVersion": "4",
  "agents": [
    {
      "disabled": false,
      "name": "My Action",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "message": "edit maps"
        }
      },
      "position": {
        "x": 1140,
        "y": -3480
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "REVERSE",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "reverse": "=REVERSE(my_action.message)"
        }
      },
      "position": {
        "x": 1140,
        "y": -3375
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    }
  ],
  "links": [
    {
      "sourceIdentifier": 0,
      "receiverIdentifier": 1
    }
  ],
  "diagramNotes": []
}
```
