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

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
v-bacao-msft
Community Support
Community Support

Hi @Anonymous ,

 

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

4 REPLIES 4
v-bacao-msft
Community Support
Community Support

Hi @Anonymous ,

 

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.
Anonymous
Not applicable

Hi @v-bacao-msft 

 

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

 

Thank you vary much!

I have tried this method to compare two arrays and if the item doesnt exist in the second list to create it but when I run it again it creates all the items in the array again not just the new item.

 

Is there a way to loop through all the items and just create the new items?  I will also want to update if there is something changed...

 

I am trying to do a one way sync with Azure SQL table to sharepoint online list.

HI!

In the list Share Point I have two columns start date and end date, how do I create an array with dates between these two dates?  

*I want to count whether it coincides with the list of public holidays to calculate the number of vacation days without holidays.

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.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,987)