Hi Guys,
I'm having some issues with a filter query from SharePoint.
I'm looking to pull records greater than 60 days old.
I've tried:
Created ge '@{addDays(utcNow(),60,'yyyy-MM-dd')}'
Created ge '@{addDays(utcNow(),60,'yyyy-MM-dd')}' and Created lt '@{addDays(utcNow(),90,'yyyy-MM-dd')}'
I don't seem to return any data.
Any ideas please?
Solved! Go to Solution.
It seems to me that you are adding 60 days to the current day, which isn't going to give you any files (because files cannot be created 60 days into the future). Try this instead:
addDays(utcNow(),-60,'yyyy-MM-dd')
It's the same as your expression except the parameter for addDays is -60 and not plus 60
Looking at your screenshot, you want to show dates after October 30th, 2020. The Created date of the item in your output is November 10, 2020 which is within your desired criteria. Are you perhaps confusing the month and days? The zulu format is year-month-day. If you are wanting to get all items that are 60 days and OLDER, then you need to use le (less or equal) and not ge (greater or equal) with the -60.
-----------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
It seems to me that you are adding 60 days to the current day, which isn't going to give you any files (because files cannot be created 60 days into the future). Try this instead:
addDays(utcNow(),-60,'yyyy-MM-dd')
It's the same as your expression except the parameter for addDays is -60 and not plus 60
Hi @Paulie78,
Thanks, thats returning data now.
Small problem, it's returning dates for 10/11/2020 which is less than 60.
I only want to return dates 60 day or greater.
(ultimately the flow will delete any records older than 60 days)
Hi @Penfold623
Odata filter queries working with dates - https://www.youtube.com/watch?v=yeAnuTB85eg&t=814s
--------------------------------------------------------------------------------
If this post helps answer your question, please click on โAccept as Solutionโ to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Thanks,
Reza Dorrani, MVP
YouTube
Twitter
I think you are going to need to provide more information and show your flow. I used a Get Items action and on the filter used:
Created ge '@{addDays(utcNow(),-3,'yyyy-MM-dd')}'
I compared that to a filtered list view and I get the same data (using [Today]-3). I would then do a Compose with a length() function of the output so I could count the number of records and they match. Please check your list data. I would encourage you to do some testing with compose and that adddays() expression and compare to the created dates via another compose to ensure you are truly getting apples to apples.
Hi @RezaDorrani,
Great video, thanks ๐
I'm not sure what I'm doing wrong...
Filter Query:
Created gt '@{formatDateTime(addDays(utcNow(),-60),'yyyy-MM-dd')}'
Filter Results:
Output:
I still seem to be pulling data before 60 days have expired.
Looking at your screenshot, you want to show dates after October 30th, 2020. The Created date of the item in your output is November 10, 2020 which is within your desired criteria. Are you perhaps confusing the month and days? The zulu format is year-month-day. If you are wanting to get all items that are 60 days and OLDER, then you need to use le (less or equal) and not ge (greater or equal) with the -60.
-----------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Oh no worries it happens to us all! Glad that is all it was.
@Penfold623 thanks for the feedback and confirming the issue is resolved now.
Looking at your screenshot, you want to show dates after October 30th, 2020. The Created date of the item in your output is November 10, 2020 which is within your desired criteria. Are you perhaps confusing the month and days? The zulu format is year-month-day. If you are wanting to get all items that are 60 days and OLDER, then you need to use le (less or equal) and not ge (greater or equal) with the -60.
-----------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Join digitally, March 2โ4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!
Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.
User | Count |
---|---|
88 | |
58 | |
42 | |
37 | |
36 |
User | Count |
---|---|
85 | |
72 | |
61 | |
56 | |
40 |