Im trying to filter query for get items from sharepoint so that it does not get items that are equal to today.
The format when it pulls from sharepoint is as such.
"Created":"2022-11-07T12:06:55Z"
How can I write the filter query to it excludes those items, I've tried to format in the expression but with no luck. Thank you.
Solved! Go to Solution.
Then Scott is right that you only need the less than. But I would still use the Compose to get the full dateTime in ISO8601 format for midnight. In my experience the comparisons don't work correctly if you aren't using full ISO 8601 format. So try it with the first Compose I had in my screenshot and set Created lt that compose value.
Try this for your filter query:
Created lt 'formatDateTime(utcNow(), 'yyyy-MM-dd')'
Obviously, the formatDateTime() expression must be entered inside of the expression window.
Because it includes the time component you can't really use equals. What you need to do is provide a range. Test it for Created is less that today at midnight and Created is greater than yesterday at midnight.
@Pstork1 Thank you that makes sense on the range vs. equal. Pardon my lack in knowledge but how do I put today at midnight and yesterday at midnight? your guidance is appreciated.
The easiest way is to use a Compose and populate it with Yesterday at Midnight (which is today at 00:00). Then another Compose to AddDay(midnight,1) to it for today. Here's a screenshot of an example
If the objective is to exclude items that were not created today, I believe that the expression that I posted above will work (time zone not withstanding).
Created lt 'formatDateTime(utcNow(), 'yyyy-MM-dd')'
@ScottShearer Hi Scott - thanks for your reply. I tried that but it still included it in the get items output. It may be that utc now its taking into consideration at that moment the flow runs vs a range of time (best guess)
I may have read it wrong. I thought he was trying to include only the items created or modified today.
Then Scott is right that you only need the less than. But I would still use the Compose to get the full dateTime in ISO8601 format for midnight. In my experience the comparisons don't work correctly if you aren't using full ISO 8601 format. So try it with the first Compose I had in my screenshot and set Created lt that compose value.
User | Count |
---|---|
89 | |
37 | |
26 | |
13 | |
13 |
User | Count |
---|---|
127 | |
54 | |
38 | |
24 | |
21 |