cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
zaphod88
Resolver IV
Resolver IV

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

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 III
Super User III

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!



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!



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

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
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (40,363)