cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

SharePoint - Get Items - Filter Query

Hello,

I am currently creating a flow, which is supposed to be run upon certain items from the list.

I can help my self with the condition, that does that, but then the flow has to process every single item in the list.

I was wondering if I can help my self using Filter Query in the step of Get items.

 

I have a column containing a date (Due_date) and I need to select only those items, where Due_date is lesser than Today.

So I have tried this: Due_date lt 'utcNow()'

Obviously it does not work, that's why I am here and wondering if it is even possible or if the filter options are limited.

 

Thanks in advance.

Marek

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

I believe that I have found the solution

 

Due_date lt '@{body('Current_time')}' - please note that '@{body('Current_time')}' is generated by including the time object, I am having issues upload the picture for some reason, tried 5 times and gave up.

 

But, now if I would want to add 1 more condition like, do not include items where Status eq finished, do I just write and in between or something like that?

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

I believe that I have found the solution

 

Due_date lt '@{body('Current_time')}' - please note that '@{body('Current_time')}' is generated by including the time object, I am having issues upload the picture for some reason, tried 5 times and gave up.

 

But, now if I would want to add 1 more condition like, do not include items where Status eq finished, do I just write and in between or something like that?

View solution in original post

@Anonymous yes you do, just add and then the second part of the filter query.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

ScottShearer
Super User
Super User

@Anonymous 

You'll need to convert the date to the same format as SharePoint stores dates internally.

Your filter should look like this:

Due_Date lt 'formatDateTime(utcNow(),'yyyy-MM-dd')'

The single quotes are required.  You need to enter formatDateTime() as an expression.

formatDateTime.jpg

 

 

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

Scott
Anonymous
Not applicable

Hi @ScottShearer and thanks for your help, I have used the Dynamic Content of Current Time for the comparison 🙂

But thanks for your suggestions, have a great day!

@Anonymous the comparison needs to use the US yyyy-MM-dd format, it won't work otherwise. So do try what Scott has said as it is the way to do it.

Rob
Los Gallardos

Anonymous
Not applicable

@RobElliott - I've tried the flow bunch of time using just the Dynamic Content and it works like a charm.

 

image.png

@Anonymous but you said "So I have tried this: Due_date lt 'utcNow()Obviously it does not work". I've lost track of what you are asking.

Rob
Los Gallardos

Anonymous
Not applicable

@RobElliott - Sorry for making this thread a mess.

1) I've asked with the non-functional query you mentioned

2) Before anyone responded I figured out that I can use the Dynamic Content and wrote a reply that I later marked as a solution

3) I was still wondering how can I add another parameter to the filter which you have clarified

 

Shortly, everything is fine now and sorry for the chaos 🙂

Thanks for your contribution

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (1,828)