Skip to content

add array functions #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions content/docs/fields/field-types/formula/array-functions.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
title: 'Array functions'
description: 'This article explains various array functions that can be used in formula fields.'
tags: ['Fields', 'Field types', 'Formula', 'Array']
keywords: ['Fields', 'Field types', 'Formula', 'Array', 'Create formula field', 'Array functions']
---

This cheat sheet provides a quick reference guide for various array functions commonly used in data analysis and programming. Each function is accompanied by its syntax, a sample usage, and a brief description.


## ARRAYSORT
The ARRAYSORT function sorts an array result from links or lookup.

#### Syntax
```plaintext
ARRAYSORT(array, ["asc" | "desc"])
```

#### Sample
```plaintext
ARRAYSORT({LookupField}, "desc")
```

#### Remark
This function sorts an array result given from links or lookup field.
The 2nd parameter is the sort order, "asc" or "desc" to sort the values ascending or descending, with "asc" as the default if not provided.

---

## ARRAYUNIQUE
The ARRAYUNIQUE function returns unique items from the given array.

#### Syntax
```plaintext
ARRAYUNIQUE(array)
```

#### Sample
```plaintext
ARRAYUNIQUE({Field})
```

#### Remark
This function removes duplicate values, leaving only unique items from the given array.

---

## ARRAYCOMPACT
The ARRAYCOMPACT function removes null and empty from result.

#### Syntax
```plaintext
ARRAYCOMPACT(array)
```

#### Sample
```plaintext
ARRAYCOMPACT({Field})
```

#### Remark
This function removes null and empty, leaving only visible items from given array.

---

## ARRAYSLICE
The ARRAYSLICE function takes partial array values from start to (optional) end.

#### Syntax
```plaintext
ARRAYSLICE(array, start, [end])
```

#### Sample
```plaintext
ARRAYSLICE({Field}, 2, 3)
```

#### Remark
This function takes the array value partially, from start to (optional) end.
2nd parameter is the start index. Index start at 1.
3rd parameter is the end index. In the example above it'll take array value 2 and 3, giving a total 2 items.
Omitting end index will take the rest of items starting from start index.
Either start or end index cannot be negative. End index need to be bigger or equal with start index. Doing so will return empty as result.

---
1 change: 1 addition & 0 deletions content/docs/fields/field-types/formula/formula.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ keywords: ['Fields', 'Field types', 'Formula', 'Create formula field']
- [Numeric Functions](/docs/product-docs/fields/field-types/formula/numeric-functions)
- [String Functions](/docs/product-docs/fields/field-types/formula/string-functions)
- [Date Functions](/docs/product-docs/fields/field-types/formula/date-functions)
- [Array Functions](/docs/product-docs/fields/field-types/formula/array-functions)
- [Conditional Expressions](/docs/product-docs/fields/field-types/formula/conditional-expressions)


Expand Down
1 change: 1 addition & 0 deletions content/docs/fields/field-types/formula/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"numeric-functions",
"string-functions",
"date-functions",
"array-functions",
"conditional-expressions",
"generic-functions",
"formula-result-formatting"
Expand Down
Loading