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

Filter query for tasks coming due in next 15 days

Hi,

 

I am working on a flow which sends a consolidated report out listing all tasks (its working already). The flow will run every monday, so the idea is to send just the tasks in one email to a user that are due in next 15 days not all the tasks. So I need help on putting in correct filter query formula under get items action, if someone can help, would appreciate.

 

thanks in advance. 

1 ACCEPTED SOLUTION

Accepted Solutions

@Anonymous and @AlanPs1 :

 

If I understand the issue correctly, the goal is to limit the number of items to just those dues within the next 15 days.  If that is the case, you are better off using an OData filter in the Get Items action.  The filter can be constructed so that only items due within the next 15 days are returned.  No need to filter item after that.

 

Please note that you need to use SharePoint internal column names in the OData filter and not the display name - they may not be the same.  If you have spaces in the name, they will definitely be different.

 

The Get Items configuration would look like this:

DateFilter.jpg

 

If this addresses your issue, plase mark your post as Solved.

 

Scott

 

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

Scott

View solution in original post

4 REPLIES 4
AlanPs1
Resident Rockstar
Resident Rockstar

Hi @Anonymous 

I would advise using "Get Items", then normally I just use "Filter Array" and use WDL to construct an expresion that filters as you want it to. See below:Capture-160.png

In this example it will only return those with created date that is 15 days ago, all others older and newer dates will be filtered out. You can change the drop down to suit and change the expression to suit. Depending on how you construct the expression will depend on the options you choose in the dropdown, ie, equal to, not equal too. Maybe less that or equal to, greater or equal to. You get the idea I am sure.

 

Here is a useful link - Functions reference for Workflow Definition Language in Azure Logic Apps

You will find utcNow(), formatDateTime() etc all on there and you should be able to acheive the filter you require.

 

There are lots of posts that deal with expressions out there you will find in the forum but once you're further on and if you were to get stuck just post back.

 

If you have found my post helpful, please mark thumbs up.

Thanks, Alan


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


Anonymous
Not applicable

@AlanPs1  thanks. Is there no way to achive this just via filter query? Adding condition would complicate things for me so really looking for a filter query here.

Hi @Anonymous .

Yes, there is and here is the reference I use when working with Odata filters.

Use query parameters to customize responses

Flow guides on the following format:

stringColumn eq 'string' OR numberColumn lt 123

so based on your paramaters:

dueDate ge '2019-02-20T08:00' and le '2017-03-06T17:00'

You will then need to consider creating some variables to handle the current day and 15 days from now but basically, this is how it is done. You will also need to consider date/time format and the likes too.

For me, I prefer the "Filter Array" and can acheive the same type of thing but above is what you are looking for.

 

Thanks, Alan

 


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


@Anonymous and @AlanPs1 :

 

If I understand the issue correctly, the goal is to limit the number of items to just those dues within the next 15 days.  If that is the case, you are better off using an OData filter in the Get Items action.  The filter can be constructed so that only items due within the next 15 days are returned.  No need to filter item after that.

 

Please note that you need to use SharePoint internal column names in the OData filter and not the display name - they may not be the same.  If you have spaces in the name, they will definitely be different.

 

The Get Items configuration would look like this:

DateFilter.jpg

 

If this addresses your issue, plase mark your post as Solved.

 

Scott

 

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

Scott

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (3,359)