cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Wizby01
Frequent Visitor

Filter list based on date comparison

Hi all

 

I have a flow that is run from the dataverse on a reoccurring schedule. I am trying to filter the "List Rows" function by comparing the date field i have to compare is the below.

softsys_z_system_lastpayto

I have tried to compare 

softsys_z_system_lastpayto@OData.Community.Display.V1.FormattedValue

but I cannot get this format recognised by the "List Rows"

 

I want to compare this date with "softsys_z_system_lastpayto" eq formatDateTime(addDays(utcNow(),-30),'yyyy-MM-dd')

 

As you can see by my flow i have tried also "Get past time" but as this flow will run at 4am the times will not match in the following format.

2022-10-12T13:00:00Z

Any assistance would be appreciated

Wizby01_0-1669323922788.pngWizby01_1-1669323952539.png

Wizby01_2-1669324064493.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
grantjenkins
Community Champion
Community Champion

Since you also have the time in your Dataverse dates you will need to do something that checks to see if the date and time is on or after the start of the day 30 days from now and before the start of the day 31 days from now. Note that we're using ge and lt for the comparison operators.

 

softsys_z_system_lastpayto ge '@{startOfDay(addDays(utcNow(), 30))}' and softsys_z_system_lastpayto lt '@{startOfDay(addDays(utcNow(), 31))}'

 

//start of the day 30 days from now
startOfDay(addDays(utcNow(), 30))

//start of the day 31 days from now
startOfDay(addDays(utcNow(), 31))

 



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

View solution in original post

4 REPLIES 4
abm
Super User
Super User

Hi @Wizby01 

The filter query looks ok to me except you are comparing using the operator 'eq'

 

"softsys_z_system_lastpayto" eq formatDateTime(addDays(utcNow(),-30),'yyyy-MM-dd')

 

In your example data highlighted in yellow colour the value is 13/10/2022. Also you mentioned about another date which is on the 12th. I am a little bit lost here obviously 12th is not equal to 13.

 

2022-10-12T13:00:00Z

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
Wizby01
Frequent Visitor

Sorry the highlighted date was just my preferred format, i.e. 13/10/2022 rather than 2022-10-13T13:00:00Z. My concern was that if i compare 2022-10-13T13:00:00Z with the term eq then the date will match but the time will not. i.e. T13:00:00Z

grantjenkins
Community Champion
Community Champion

Since you also have the time in your Dataverse dates you will need to do something that checks to see if the date and time is on or after the start of the day 30 days from now and before the start of the day 31 days from now. Note that we're using ge and lt for the comparison operators.

 

softsys_z_system_lastpayto ge '@{startOfDay(addDays(utcNow(), 30))}' and softsys_z_system_lastpayto lt '@{startOfDay(addDays(utcNow(), 31))}'

 

//start of the day 30 days from now
startOfDay(addDays(utcNow(), 30))

//start of the day 31 days from now
startOfDay(addDays(utcNow(), 31))

 



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.
Wizby01
Frequent Visitor

Love your work grantjenkins, it works really well.

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (4,600)