ArrayIntersection
Last updated
Was this helpful?
Last updated
Was this helpful?
The ArrayIntersection function compares two arrays and returns an array of all overlapping elements, without duplicates. The output array is unordered.
Function arguments:
array1
Array to be compared for overlapping elements.
array2
Array to be compared for overlapping elements.
If either or both input arguments are null values, the function returns null
.
The function is βnull awareβ. If both input arrays contain a null element, the returned array will contain one.
If there are no overlapping values, an empty array is returned.
If one or both of the input arguments are non-null values or non-array variants (such as an object, or other json), an empty array is returned.
A table lists all the available colors of different clothing items. To see what items are available in black or white, you can use the ArrayIntersection function:
ArrayIntersection compares the arrays listed in the [Colors]
column with the ("black", "white")
array.
Both βblackβ and βwhiteβ are present in the Colors column for Shoes, so ArrayIntersection returns an array with both colors. As nothing is listed in the Pants row, the function returns a null value.