From 72256e205bf9884e3e904006cc34314f9aa6bd76 Mon Sep 17 00:00:00 2001 From: Fendy Heryanto Date: Fri, 11 Jul 2025 10:11:33 +0700 Subject: [PATCH 1/2] add array functions --- .../field-types/formula/array-functions.mdx | 46 +++++++++++++++++++ .../fields/field-types/formula/formula.mdx | 1 + .../docs/fields/field-types/formula/meta.json | 1 + 3 files changed, 48 insertions(+) create mode 100644 content/docs/fields/field-types/formula/array-functions.mdx diff --git a/content/docs/fields/field-types/formula/array-functions.mdx b/content/docs/fields/field-types/formula/array-functions.mdx new file mode 100644 index 0000000..6f0cdd5 --- /dev/null +++ b/content/docs/fields/field-types/formula/array-functions.mdx @@ -0,0 +1,46 @@ +--- +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. + +--- \ No newline at end of file diff --git a/content/docs/fields/field-types/formula/formula.mdx b/content/docs/fields/field-types/formula/formula.mdx index d6e4663..a10b40e 100644 --- a/content/docs/fields/field-types/formula/formula.mdx +++ b/content/docs/fields/field-types/formula/formula.mdx @@ -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) diff --git a/content/docs/fields/field-types/formula/meta.json b/content/docs/fields/field-types/formula/meta.json index 5600427..9541036 100644 --- a/content/docs/fields/field-types/formula/meta.json +++ b/content/docs/fields/field-types/formula/meta.json @@ -6,6 +6,7 @@ "numeric-functions", "string-functions", "date-functions", + "array-functions", "conditional-expressions", "generic-functions", "formula-result-formatting" From 23da689825f52b6d943f71a4a2140f7cc1e0f6ad Mon Sep 17 00:00:00 2001 From: Fendy Heryanto Date: Wed, 16 Jul 2025 10:19:53 +0700 Subject: [PATCH 2/2] add array compact and slice to document --- .../field-types/formula/array-functions.mdx | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/content/docs/fields/field-types/formula/array-functions.mdx b/content/docs/fields/field-types/formula/array-functions.mdx index 6f0cdd5..c32d035 100644 --- a/content/docs/fields/field-types/formula/array-functions.mdx +++ b/content/docs/fields/field-types/formula/array-functions.mdx @@ -43,4 +43,44 @@ 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. + --- \ No newline at end of file