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

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

# COMPACT

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

Removes any `null` values from an array.

**Categories:** Arrays

## Syntax

```
COMPACT(array)
```

## Examples

### Example 1

Input:

```json
{
  "my_action": {
    "message": [
      "one",
      null,
      "three",
      "four",
      null
    ]
  }
}
```

Formula:

```
COMPACT(my_action.message)
```

Output:

```json
[
  "one",
  "three",
  "four"
]
```

## Sample actions

```json
{
  "standardLibVersion": "13",
  "actionRuntimeVersion": "1",
  "agents": [
    {
      "disabled": false,
      "name": "COMPACT",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "compact": "=COMPACT(my_action.array_with_null)"
        }
      },
      "position": {
        "x": -6675,
        "y": -1380
      },
      "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": {
          "array_with_null": [
            "apple",
            null,
            "banana",
            "grape",
            null
          ]
        }
      },
      "position": {
        "x": -6675,
        "y": -1500
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    }
  ],
  "links": [
    {
      "sourceIdentifier": 1,
      "receiverIdentifier": 0
    }
  ],
  "diagramNotes": []
}
```
