FunctionCopy link to clipboard
intersection( array1, array2 )
Returns only those elements that appear in all of the given arrays.
ParametersCopy link to clipboard
Keyword | Type | Description |
---|---|---|
|
Any Type Array |
Array to intersect. |
|
Any Type Array |
Array to intersect. |
ReturnsCopy link to clipboard
Any Type Array, matching the type of the inputs
ExamplesCopy link to clipboard
Find the values that are common in two integer arraysCopy link to clipboard
intersection({1, 2, 3, 4}, {3, 4, 5, 6})
returns an array with 3, 4
Find the values that are common in two text arraysCopy link to clipboard
Values are matched case sensitively:
intersection({"a", "b", "A"}, {"a", "c"})
returns an array with a
To match items case insensitively, use the lower()
function on both inputs.
A value is returned for each match:
intersection({"a", "b", "a"}, {"a"})
returns an array with a, a
Types of the arrays must matchCopy link to clipboard
intersection({"a"}, {1})
returns the following error message: Invalid types, can only act on data of the same type
.
Use either the conversion functions or the cast()
function to convert to the appropriate type.
Empty or null arraysCopy link to clipboard
When one of the arrays is empty, or no common values are found, an empty array of the same type as the inputs is returned:
intersection({1}, tointeger({}))
returns an empty integer array.
intersection({"a"}, {"b"})
returns an empty text array.
Null values in the array are matched and returned:
intersection({1, null, 3}, {1, null, 4})
returns an array with 1, <null>
Compare more than two arraysCopy link to clipboard
An unlimited number of arrays can be compared, and the values common to all of them are returned:
intersection({1, 2}, {2, 3}, {2, 4})
returns an array with 2
Scalar inputsCopy link to clipboard
Scalar inputs are cast to arrays:
intersection(1, 1)
returns an array with 1
Feature compatibilityCopy link to clipboard
The table below lists this function's compatibility with various features in Appian.
Feature | Compatibility | Note |
---|---|---|
Portals | Compatible | |
Offline Mobile | Compatible | |
Sync-Time Custom Record Fields | Compatible | Can be used to create a custom record field that only evaluates at sync time. |
Real-Time Custom Record Fields | Incompatible | Custom record fields that evaluate in real time must be configured using one or more Custom Field functions. |
Process Reports | Compatible | |
Process Events | Compatible | |
Process Autoscaling | Compatible |