contains function. Collection.(Power Automate Cloud flows)

02/22/2024

Japanese version.

This function checks whether an array contains a specified item.

There is also a function of the same name that checks whether a given text is contained.

Spec

contains(<collection>,<value>)
ArgumentDefaultDescription
collectionRequired fieldTarget array.
valueRequired fieldThe item to search.

How to use

Often used in "Condition".

It is also frequently used to initialize or set variables of type "Boolean" in order to use the result in subsequent actions.

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

If you see something like the following, your settings are complete.

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

In this case, array variables [1,2,3] are provided as an example.

If we set the expression as contains(variables('array1'),2) , The result is True because [1,2,3] contains "2".

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

(How to get dynamic content with expressions.)

Elements may be non-numeric.

For strings, the search is case-insensitive and exact match is performed.

To incorporate the result of this function into a "Condition" action, set the following.

LeftThe result of the contains function.
Centeris equal to
Righttrue

"If yes" is the action when the specified item exists, and "If no" is the action when the specified item does not exist.

For those who want to learn Power Automate Cloud flow effectively

The information on this site is now available in an easy-to-read e-book format.

Or Kindle Unlimited (unlimited reading).

You willl discover how to about basic operations.

By the end of this book, you will be equipped with the knowledge you need to use Power Automate Cloud flow to streamline your workflow.

Links

Collection Functions(Power Automate Cloud flows)