intersection function. Collection.(Power Automate Cloud flows)

01/07/2024

Japanese version.

Function to create a new array with the common items of two arrays.

Spec

intersection(<collection1>,<collection2>)
ArgumentDefaultDescription
collection1,2Required fieldTarget arrays.

How to use

In many cases, it is used to initialize or set variables of type "Array".

Clicking on intersection in the "Expression" tab sets the function name and () in the formula field.

The argument is two arrays.

When dynamic content or variables are used in expressions, special specifications are required.

(How to get dynamic content with expressions.)

If you see something like the following, the setup is complete.

You can change the contents of the function by clicking on the purple icon.

This time, as an example, we have two array variables. [100,300,400] and [100,200,300,500].

Execute the following expression "intersection(variables('ary1'),variables('ary2'))"

The common items, 100 and 300, are extracted into an array.

Usage Example. Determining if there is a common item.

When combined with Condition and length, it can be used to determine if there is a common item.

Leftlength(intersection(variables('ary1'),variables('ary2')))
Centeris greater than
Rigth0

The results are as follows.

If yesCommon items exist.
If noNo common item exists.

---

Links

Collection Functions(Power Automate Cloud flows)