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
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

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

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

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 (3,314)