Skip to main content

07.7 Array Functions

Algorithm

Operators in this group provide the ability to perform operations on arrays and array elements.

tip

Elements of the array can be strings, numbers, or boolean values.

Result

add

This operator adds a value to the specified variable to create an array. See Scenario Example Using SetVariables.

  • Result of the expression: Value in the array.

join

It concatenates all the array elements into a string, adding the specified delimiter between each array element.

  • Execution Result: text with the specified delimiter.
  • Example: If _.Array = [1,2,3,4,5], then "1.2.3.4.5".

slice

Returns a modified array containing the specified elements from the provided array.

tip

The specified numbers are the ordinal numbers of the array elements. In the example below, it returns elements from the zeroth (exclusive) to the first (inclusive) element. The ending number may be omitted, in which case, it will return all elements of the array after the initial number.

  • Execution Result: an array of values.
  • Example: If 1.Body = [{"Value": "Hi"}, {"Value": "Latenode"}], then [{"Value": "Hi"}].

merge

Merges two or more passed arrays into one array.

  • Execution Result: an array of values.
  • Example: If 1.Body[0] = [{"Value": 5}, {"Value": 10}] and 1.Body[1] = [{"Value": 15}, {"Value": 20}], then [{"Value": 5}, {"Value": 10}, {"Value": 15}, {"Value": 20}].

map

Returns an array containing the desired values of the given complex array. Can be used for filtering values.

  • Execution Result: an array of found values.
  • Example:

Input data:

[
{
"Name": "Kate",
"Address": "Tokyo",
"Age": 25
},
{
"Name": "Anna",
"Address": "Seoul",
"Age": 35
},
{
"Name": "Lisa",
"Address": "Beijing",
"Age": 45
}
]

Result:

[
25,
35,
45
]

sort

Returns an array containing values of the given array sorted in the desired order. Sorting options available:

  • asc - in ascending order;
  • desc - in descending order;
  • asc ci - in ascending order, case-insensitive;
  • desc ci - in descending order, case-insensitive.
  • Execution result: an array of sorted values.
  • Example: If 1.Body = [{ "Value": 5}, {"Value": 10},{ "Value": 15}, {"Value": 20}], then [{ "Value": 20}, {"Value": 15},{ "Value": 10}, {"Value": 5}]

deduplicate

Removes duplicate values from the given array and returns an array with unique values.

  • Execution result: an array of unique values.
  • Example:

Input data:

[
{
"Name": "Kate",
"Age": 45
},
{
"Name": "Anna",
"Age": 45
},
{
"Name": "Lisa",
"Age": 45
},
{
"Name": "Lisa",
"Age": 45
},
{
"Name": "Anna",
"Age": 25
}
]

Result:

[
{
"Age": 45,
"Name": "Kate"
},
{
"Age": 45,
"Name": "Anna"
},
{
"Age": 45,
"Name": "Lisa"
},
{
"Age": 25,
"Name": "Anna"
}
]

distinct

Removes duplicates from the given array and returns an array with unique values. All duplicates are removed based on the specified key, except for the first found value.

  • Execution result: an array of unique values.
  • Example 1:

Input data:

[
{
"Name": "Kate",
"Age": 45
},
{
"Name": "Anna",
"Age": 45
},
{
"Name": "Lisa",
"Age": 45
},
{
"Name": "Lisa",
"Age": 45
},
{
"Name": "Anna",
"Age": 25
}
]

Result:

[
{
"Age": 45,
"Name": "Kate"
},
{
"Age": 25,
"Name": "Anna"
}
]
  • Example 2:

Input data:

[
{
"Name": "Kate",
"Age": 45
},
{
"Name": "Anna",
"Age": 45
},
{
"Name": "Lisa",
"Age": 45
},
{
"Name": "Lisa",
"Age": 45
},
{
"Name": "Anna",
"Age": 25
}
]

Result:

[
{
"Age": 45,
"Name": "Kate"
},
{
"Age": 45,
"Name": "Anna"
},
{
"Age": 45,
"Name": "Lisa"
}
]
  • Example 3:

Input data:

[
{
"Name": "Kate",
"Age": 45
},
{
"Name": "Anna",
"Age": 45
},
{
"Name": "Lisa",
"Age": 45
},
{
"Name": "Lisa",
"Age": 45
},
{
"Name": "Anna",
"Age": 25
}
]

Result:

[
{
"Age": 45,
"Name": "Kate"
},
{
"Age": 45,
"Name": "Anna"
},
{
"Age": 45,
"Name": "Lisa"
},
{
"Age": 25,
"Name": "Anna"
}
]