cancel
Showing results for
Did you mean:
Resolver I

## Compare values from two strings

SHi guys,

I have 2 strings in my flow:

String 1

["2022-03-15","2022-03-31","2022-05-10","2022-05-30"]

String 2

["2022-03-26","2022-03-27","2022-03-28","2022-03-29","2022-03-30","2022-03-31"]

Is there a way to compare both Strings and find out if there is any date on both strings?

(In this case 2022-03-31)

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Solution Sage

You can split the strings by the comma, then intersect both arrays to get the strings they have in common

``intersection(split('"2022-03-15","2022-03-31","2022-05-10","2022-05-30"',','),split('"2022-03-26","2022-03-27","2022-03-28","2022-03-29","2022-03-30","2022-03-31"',','))``

will return "2022-03-31"

4 REPLIES 4
Solution Sage

You can split the strings by the comma, then intersect both arrays to get the strings they have in common

``intersection(split('"2022-03-15","2022-03-31","2022-05-10","2022-05-30"',','),split('"2022-03-26","2022-03-27","2022-03-28","2022-03-29","2022-03-30","2022-03-31"',','))``

will return "2022-03-31"

Resolver I

Thanks @KvB1  it works that way.

Although I want to use with variables, and it doesnt work.

Expression: intersection(split(variables('st1'),','),split(variables('st2'),','))

It doesnt return me anything

Solution Sage

This is most likely because of the [ ] that you used to enclose the string. You don't need to do this when initializing the variable.

Because the only date in common is the last one in the second string but not in the first one, it is comparing "2022-03-31"]  to  "2022-03-31"  which obviously doesn't match

Resolver I

Got it!

Just removed the [" and it works.

Announcements

#### December 2023 User Group Update: Welcoming New Groups and Upcoming Events

A new month means it's time to celebrate and welcome the new user groups that have joined our community. We are excited to announce that we have more than 8 New Groups, which is no surprise after the amazing Microsoft Power Platform Conference. This month, we are breaking them out by the different community categories. If your group is listed here, give this post a kudo so we can celebrate with you! Don't forget to take a look at the many events happening near you or virtually! It's a great time of year to connect and engage with User Groups both locally and online.   Please Welcome Our NEW User Groups   Power Platform: PowerIT User Group: Nottingham Power Platform User Group: Bergen Power Platform User Group: Danmark Nashville Power Platform User Group Microsoft Ambassador Program y Mujer Latina Technolochicas NCWIT Community Copilot Studio:  Copilot User Group Italia Dynamics365: Dynamics User Group AdriaticDynamic 365 Azerbaijan   December User Group Events   01 Dec 2023 Aprendiendo Desarrollo web, creando mi primer power app y power page. 01 Dec 2023 Q4 Hybrid Philadelphia Dynamics 365 & Power Platform User Group Meeting05 Dec 2023APAC Dynamics 365 FastTrack Bootcamp - BI and Analytics07 Dec 2023Bay Area Power Platform Meetup: Learn, Share, and Connect07 Dec 2023Indiana D365/AX December User Group Meeting07 Dec 2023Dynamics User Group Meeting: Houston09 Dec 2023 December '23 - NEW Power Apps User Group Meeting - Online 12 Dec 2023December Cleveland Power Platform User Group Meeting12 Dec 2023 RW2 Data Stewardship Open Forum Discussion 13 Dec 2023  Black Country Power Platform User Group - December 2023 - West Midlands