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 Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,492)