cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Create a loop that runs if a value in one array equals any of the values in another array.

Essentially I have two arrays, lets call them array X and array Y. I want to check each variable inside of array X, to see if it matches any variable inside array Y. Each time it does match, my loop will run. 

 

Ex: 

Array X { test , test2 , test 3 }

Array Y { test, test3, test4, test5 }

 

The loop would run 2 times, because array X and Y share two values. 

 

Thank you! 🙂 

1 ACCEPTED SOLUTION

Accepted Solutions
JamesYumnam
Resolver III
Resolver III

Hi @Anonymous 

Please check if this helps:

JamesYumnam_0-1626965398993.png

 

View solution in original post

4 REPLIES 4
JamesYumnam
Resolver III
Resolver III

Hi @Anonymous 

Please check if this helps:

JamesYumnam_0-1626965398993.png

 

Werner_Otto
Regular Visitor

Hello davidh12, 
You can achieve this in different ways, one you can try:

Get your 2 lists
Add the first list with the values that should be found in the second list into a "Apply to each" flow node.
Next within that node, add a "Condition" control node, in this node use the condition "contains"

Werner_Otto_0-1626964990916.png

like the picture above, use your second list on the right, and the output of your condition on the left.
i had numbers 1,2,3 in list 1, and 1,3,4,5 in list 2
This is the result of my flow:

Werner_Otto_1-1626965172430.png

Werner_Otto_2-1626965195005.png

Werner_Otto_3-1626965229741.png

As you can see, the flow only continued in the first and last iteration when it checked if 1 and 3 was found in list 2.

I hope this Answers your question.

Anonymous
Not applicable

Hey @JamesYumnam,

 

Thank you for the help. I did run into an error though, unsure why: 

Capture.PNG

 

NVM --- Was using wrong variable. Thank you!!

Could you please show all the steps or atleast where you have initialised your array?

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Users online (3,465)