cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rhiheu
Advocate III
Advocate III

ODATA Filter Query - Date field is less than (or passed) Today's date

Hi,

I would like to apply an ODATA Filter Query to my SharePoint Online 'Get items' action. I have a SharePoint Date & Time field called 'Booking Date' and I would to filter the results based on when that date has passed (the Power Automate will run once a day).

So far I have:

BookingDate lt '@{formatDateTime(utcNow(),'dd-MM-yyyy')}'

But it's not finding any matches.

Does anyone have any suggestions? Any help appreciated, thanks. 

1 ACCEPTED SOLUTION

Accepted Solutions
rhiheu
Advocate III
Advocate III

Ah sorry, It was a naming mistake - it was 'Booking Date' in SharePoint and I thought I could just remove the space to make it 'BookingDate' in the ODATA Filter Query but it looks like that doesn't work. 'Booking_x0020_Date' doesn't work either. So instead I've just created a new field called 'BookingDate' and that works. If anyone knows how to get columns with spaces to work please let me know, but in the meantime I'll mark this as solved. Thanks @v-bacao-msft for your support!

View solution in original post

5 REPLIES 5
v-bacao-msft
Community Support
Community Support

Hi @rhiheu ,

 

You could try to change the format to 'yyyy-MM-dd'.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
rhiheu
Advocate III
Advocate III

Hi @v-bacao-msft, thanks for the suggestion. I've tried that:

 

BookingDate lt '@{formatDateTime(utcNow(),'dd-MM-yyyy')}'

 

But unfortunately now it says 'String was not recognised as a valid DateTime. Creating query failed.'

I'm not sure what to try next 🙂

 

Hi @rhiheu ,

 

What is the type of AptDate?

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
rhiheu
Advocate III
Advocate III

Sorry that was a typo, now fixed. BookingDate is a SharePoint Date & Time field.

rhiheu
Advocate III
Advocate III

Ah sorry, It was a naming mistake - it was 'Booking Date' in SharePoint and I thought I could just remove the space to make it 'BookingDate' in the ODATA Filter Query but it looks like that doesn't work. 'Booking_x0020_Date' doesn't work either. So instead I've just created a new field called 'BookingDate' and that works. If anyone knows how to get columns with spaces to work please let me know, but in the meantime I'll mark this as solved. Thanks @v-bacao-msft for your support!

View solution in original post

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

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (9,727)