cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Help Creating an Automated Planner Report

I'm trying to have a weekly email that contains the tasks completed the week previous.  Seems simple but I'm getting stuck comparing the "completedDateTime" with the current date. All help is appreciated. 

 

'@greaterOrEquals(item()?['completedDateTime'], addDays(utcNow('yyyy-MM-dd'), int(-7), 'yyyy-MM-dd'))'

 

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

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Help Creating an Automated Planner Report

Hi @toddmichaelryan,

 

To compare between two days, the two dates should be in the same format. Usually we use function formateDateTime to format date. To add a number of days to a timestamp, we use adddays function.

 

More details about the date and time function, please check the following doc:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#d...

 

About your scenario, please try the following code to see if it will work for you:

@greaterorequals(formatdateTime(items('Apply_to_each')?['completedDateTime'], 'yyyy-MM-dd'),formatDateTime(adddays(utcnow(),-7),'yyyy-MM-dd'))

 

The flow is created likes below and it works fine.

1.PNG 

 

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Administrator
Administrator

Re: Help Creating an Automated Planner Report

Hello, @toddmichaelryan!

 

Thank you for posting on the Flow Community Forum! Have you had an opportunity to apply @v-yamao-msft‘s recommendation to adapt your Flow? If yes, and you find that solution to be satisfactory, please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify!


Thank you for being an active member of the Flow Community!

 

-Gabriel
Flow Community Manager

- Gabriel
Community Manager
Power Automate | Power Virtual Agents
Super User Program Manager
Power Platform Communities

View solution in original post

4 REPLIES 4
Highlighted
Community Support
Community Support

Re: Help Creating an Automated Planner Report

Hi @toddmichaelryan,

 

To compare between two days, the two dates should be in the same format. Usually we use function formateDateTime to format date. To add a number of days to a timestamp, we use adddays function.

 

More details about the date and time function, please check the following doc:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#d...

 

About your scenario, please try the following code to see if it will work for you:

@greaterorequals(formatdateTime(items('Apply_to_each')?['completedDateTime'], 'yyyy-MM-dd'),formatDateTime(adddays(utcnow(),-7),'yyyy-MM-dd'))

 

The flow is created likes below and it works fine.

1.PNG 

 

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Administrator
Administrator

Re: Help Creating an Automated Planner Report

Hello, @toddmichaelryan!

 

Thank you for posting on the Flow Community Forum! Have you had an opportunity to apply @v-yamao-msft‘s recommendation to adapt your Flow? If yes, and you find that solution to be satisfactory, please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify!


Thank you for being an active member of the Flow Community!

 

-Gabriel
Flow Community Manager

- Gabriel
Community Manager
Power Automate | Power Virtual Agents
Super User Program Manager
Power Platform Communities

View solution in original post

Highlighted
Regular Visitor

Re: Help Creating an Automated Planner Report

How could you apply this to a specific date collumn in an Excel Spreadsheet?

Highlighted
New Member

Re: Help Creating an Automated Planner Report

I just had this error message, would love some help:

The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression 'va@{body('List_my_tasks_2')?['value']}' is of type 'String'. The result must be a valid array.

Helpful resources

Announcements
Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Top Solution Authors
Top Kudoed Authors
Users online (5,374)