cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bryq3
Level: Powered On

Comparing elements of two string arrays

Hello Flow Community!

 

I would like to "compare" elements in two arrays, like eg.:

 

Array1 ["apple", "orange", "banana"];

Array2 ["strawberry", "apple", "watermelon"];

 

the thing is that if at least one element (string) is the same in both arrays i would like to eg. send a message.

 

Did anyone tried something like this, or could give me some hints how to achieve that? 

 

Thanks in advance! 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Comparing elements of two string arrays

Hi @bryq3 ,

 

If this comparison does not consider index, but if it has the same element value, it need to send email. You could refer to the following method.

 

  • Initialize three variables, two array variables to store the array to be compared, and the integer variable to record how many equal element values.
  • Iterate through the array 1 and determine if array 2 contains the elements in array 1 that are currently traversed. If they are equal, the value of the integer variable is incremented by 1.
  • Finally, determine whether the value of integer is equal to 0. If it is not equal to 0, it means that the two elements have the same elements.

 

Image reference:37.PNG

38.PNG39.PNG

 

Hope it helps.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: Comparing elements of two string arrays

Hi @bryq3 ,

 

If this comparison does not consider index, but if it has the same element value, it need to send email. You could refer to the following method.

 

  • Initialize three variables, two array variables to store the array to be compared, and the integer variable to record how many equal element values.
  • Iterate through the array 1 and determine if array 2 contains the elements in array 1 that are currently traversed. If they are equal, the value of the integer variable is incremented by 1.
  • Finally, determine whether the value of integer is equal to 0. If it is not equal to 0, it means that the two elements have the same elements.

 

Image reference:37.PNG

38.PNG39.PNG

 

Hope it helps.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
bryq3
Level: Powered On

Re: Comparing elements of two string arrays

Hi @v-bacao-msft 

 

It works and that is exactly what i was looking for 🙂 

 

Thank you vary much!

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons in April

Read the announcement for more information!

firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (10,391)