cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
zaphod88
Responsive Resident
Responsive Resident

Comparing two dates: Condition not correctly working

Hello everyone,

 

I'm currently working on a vacation request app using PowerApps, Flow and Sharepoint as database. As not all of my coworkers are working every weekday (this part is not implemented yet) and as there are weekends and public holidays, I want to calculate the count of requested vacation days using Flow. Therefore there is an array function that fills the dates between requested Start and End Date. This already works well.

 

In Sharepoint, there is a list containing the public holidays that are not counted as vacation days. In the flow, there's an if function that checks if the weekday of each of the array's dates is 0 or 6 or if it's the same date as one of the vacation days from the SP list. If none of those conditions is met, there's an incrementing variable to calculate the number of vacation request days.

Unfortunately, it does not really work. There is a date in this SP list (04/10/2020) that is also contained in the array, but when they are compared, the integer variable is nevertheless incremented.  What's funny is that there is another date in the SP list (04/13/2020) that is flawlessly recognized in this comparison and therefore not counted into the integer. Both dates have the same format and are used without the time.

Does anybody know help? Or is there a possibility to build a similar workflow directly in Powerapps as there are no arrays supported?

1 ACCEPTED SOLUTION

Accepted Solutions
zaphod88
Responsive Resident
Responsive Resident

It was my fault - I did not use the right syntax comparing to the array I guess. I found a solution following and adapting the screenshots in this thread: https://powerusers.microsoft.com/t5/General-Power-Automate/Comparing-elements-of-two-string-arrays/t...

 

Thanks very much for your help.

View solution in original post

5 REPLIES 5
efialttes
Super User
Super User

Hi
04/10/2020 means 4th of October, 2020? Or 10th of April, 2020?
Hope this helps


Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



zaphod88
Responsive Resident
Responsive Resident

Hello,

 

thank you for your answer.

Both dates are in April. But I read somewhere in another thread that the problem might be that Flow isn't identifying the 10/04/2020 date as set in April but in October as it can be misunderstood. 13/04/2020 on the other hand is clearly set in April as "13" cannot be the month. Might this be the problem and how can I solve it? I thought about converting the array dates to ticks, but as I have to compare them to SP - is there any possibility to convert the dates in a SP list to ticks OOTB or do I have to do this by another flow?

@zaphod88 

It's difficult to say this can be the problem without traces (i.e. execution screenshots) but it could be.

For troubleshooting purposes my suggestion is to share the content of your array and also the expressions you are using to compare.

If the info is sensitive, another approach is to implement a test flow manually executed that would read all entries in the SP list, and print the Date column in an HTML table. Here you will find an example of what I am suggesting, please note in the example the trigger is not manual execution but insertion of a new item, but the rest of the steps are the same.

You can inspect this way the format dates are being received by your PA Flow and compare with the expressions you are using.

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



zaphod88
Responsive Resident
Responsive Resident

It was my fault - I did not use the right syntax comparing to the array I guess. I found a solution following and adapting the screenshots in this thread: https://powerusers.microsoft.com/t5/General-Power-Automate/Comparing-elements-of-two-string-arrays/t...

 

Thanks very much for your help.

No problema

Thanx for sharing!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



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.

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.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (3,242)