cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
scampanyps
Regular Visitor

OData Filter Query Using Date Comparison

Hello Community,

I have looked at many posts in this community along with blogs covering the topic of using a SharePoint Date/Time column as a comparison in an OData Filter Query.  Unfortunately the suggestions and solutions I have read in those posts have not helped me resolve the issue I am facing when trying to compare dates in the OData Filter Query. 

 

I created a new test list to use the OData Filter Query against to test syntax/filter query formatting, to ensure the issue did not correspond to list settings for an existing list I need to use date comparison with.

Here is a screen shot of my new test list: (all names are factious)

scampanyps_12-1626117977589.png

 

Here are the details of my Hire Date column

scampanyps_2-1626116718891.png

The internal field name of the column is: HireDate

 

  • I have tried multiple comparison operators, ge, lt, le, etc. 
  • I have tried using the formatdatetime expression to format both the Hire Date value and utcnow() to 'yyyy-MM-dd'.
  • I have tried with using only formatdatetime on the utcnow() expression. 
  • I have tried with single quotes (' ') around the utcnow() expression

scampanyps_5-1626117347270.png

 

  • I have tried without the single quotes (' ') around the utcnow() expression. 

scampanyps_6-1626117423005.png

 

The general error I receive is shown below:

scampanyps_13-1626118147941.png

My Flow:

scampanyps_7-1626117681849.png

scampanyps_10-1626117813191.png

 

I have tried every iteration of formatting and creating the OData filter query that I can think of.  I would be very grateful if someone could help with with this issue.

 

Thank you,

Scott

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
scampanyps
Regular Visitor

Hopefully my struggle with this will help someone else.  As you see in my previous post I was using Dynamic Content (HireDate) in my Filter Query.  I replaced the Dynamic Content with the name of the column as shown below.  This resolved the issue.

scampanyps_0-1626118839612.png

 

Could someone explain to the me the difference between Dynamic Content and using the column Name in the Filter Query?

 

Thanks again!

Scott

View solution in original post

2 REPLIES 2
scampanyps
Regular Visitor

Hopefully my struggle with this will help someone else.  As you see in my previous post I was using Dynamic Content (HireDate) in my Filter Query.  I replaced the Dynamic Content with the name of the column as shown below.  This resolved the issue.

scampanyps_0-1626118839612.png

 

Could someone explain to the me the difference between Dynamic Content and using the column Name in the Filter Query?

 

Thanks again!

Scott

View solution in original post

@scampanyps 

A Filter query in a SharePoint Get items action requires that the column name be the first parameter.  Your error message shows that the actual date is returned when you select the column name from Dynamic properties and not the column name. 

Not only does the first parameter need to be the column name, it must be the internal name which may not be the same as the display name.  For example, internal names do not have spaces.

 

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

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

Users online (971)