cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kmayes
Post Prodigy
Post Prodigy

List my tasks filter issue

Hi

 

Im creating a flow which list all my assigned tasks from planner then creates a table to add to an email.

This works well, however I would like to add the task details which is only available from the 'Get Task Details' so I have added an apply to each from the body/value of the 'List my tasks' to get each description but then I need to add this to my filtered array to then add to create htlm table

Unfortunately the flow is failing on the filter which filters the items completed in the last seven days with this message:

The execution of template action 'Filter_array_4' failed: The evaluation of 'query' action 'where' expression '@greater(item()?['completedDateTime'], adddays(utcNow(), -7, 'yyyy-MM-dd'))' failed: 'The template language function 'greater' expects two parameter of matching types. The function was invoked with values of type 'Null' and 'String' that do not match.'.

 

Is anyone able to assist as it was working outside of an apply to each?

 

Below is my flow 🙂

Kmayes_0-1613985031792.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User II
Super User II

Hi @Kmayes,

 

You could achieve that by using an array variable.

 

1. Add an initialize variable of type array at the beginning of your flow

initializeemptyarrayvariable.png

 

2. Add an append to array variable action within the apply to each loop after the get task details action and use the following content. Modify the expression if your action names are different btw.

{
"title": "@{items('Apply_to_each')?['title']}",
"description": "@{outputs('Get_task_details')?['body/description']}"
} 

 

3. Add a create HTML table outside the loop and use the array variable to generate a table.

 

appendtoarrayvariable_titledescription.png

View solution in original post

4 REPLIES 4
Expiscornovus
Super User II
Super User II

Hi @Kmayes,

 

I would place the filter arrays before the apply to each. When you do that you will only collect the details of the tasks which are meeting your filter conditions (not empty completed date time within the last week).

 

Also try and use this for the greater than condition: 

addDays(utcNow(), -7)

 

filterarrays_last7days.png

@Expiscornovus 

Thats great thanks, do you happen to know how I can the marry up the data to have it in one html table?

 

I have a select function after the apply to each so need to get the corresponding description next to the corresponding item if that makes sense?

Expiscornovus
Super User II
Super User II

Hi @Kmayes,

 

You could achieve that by using an array variable.

 

1. Add an initialize variable of type array at the beginning of your flow

initializeemptyarrayvariable.png

 

2. Add an append to array variable action within the apply to each loop after the get task details action and use the following content. Modify the expression if your action names are different btw.

{
"title": "@{items('Apply_to_each')?['title']}",
"description": "@{outputs('Get_task_details')?['body/description']}"
} 

 

3. Add a create HTML table outside the loop and use the array variable to generate a table.

 

appendtoarrayvariable_titledescription.png

View solution in original post

Thanks for your great assistance on this 🙂

Helpful resources

Announcements
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

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (38,592)