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

# UNION

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

This function merges two arrays. These arrays can either be within the same Event or from two distinct Actions. The function requires that the inputs be arrays, although it can also process an array nested within an object, as long as it directly references the array. The order of the merged array is determined by the sequence in which the paths are listed.

**Categories:** Arrays

## Syntax

```
UNION(array1, array2)
```

## Examples

### Example 1

Input:

```json
{
  "my_action": {
    "array1": [
      1,
      2,
      3
    ],
    "array2": [
      3,
      4,
      5
    ]
  }
}
```

Formula:

```
UNION(my_action.array1, my_action.array2)
```

Output:

```json
[
  1,
  2,
  3,
  4,
  5
]
```

## Sample actions

```json
{
  "standardLibVersion": "13",
  "actionRuntimeVersion": "2",
  "agents": [
    {
      "disabled": false,
      "name": "My Action",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "array1": [
            1,
            2,
            3
          ],
          "array2": [
            3,
            4,
            5
          ]
        }
      },
      "position": {
        "x": 1635,
        "y": 2355
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "UNION",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": "=UNION(my_action.array1, my_action.array2)"
      },
      "position": {
        "x": 1635,
        "y": 2430
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    }
  ],
  "links": [
    {
      "sourceIdentifier": 0,
      "receiverIdentifier": 1
    }
  ],
  "diagramNotes": []
}
```
