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

How do you find where the error is in an expression?

I have a complex expression in a Compose action. When I run the flow I get the following error:

 

InvalidTemplate. Unable to process template language expressions in action 'Status' inputs at line '1' and column '18164': 'The template language function 'if' expects three parameter: the condition to test as the first parameter, the value to return if the condition is true as the second parameter, and the value to return if the condition is false as the third parameter. The function was invoked with '1' parameter(s). 

 

I have gone over the expression and I cannot find where the issue is! I am sure it is a misplaced comma or bracket, but I cannot find it.

 

The expression is:

if(equals(outputs('Progress'),'Completed'),if(greater(formatDateTime( last(body('Filter_completed_tasks'))?['Completed_x0020_Date'] ), formatDateTime( last(body('Filter_completed_tasks'))?['Due_x0020_date'] )), 'Delivered late''Delivered on-time'), if(empty(body('Filter_not_started_tasks')), 'Error', if(greater(utcNow(), formatDateTime( last(body('Filter_not_started_tasks'))?['Due_x0020_date'] )), 'Behind schedule','On-target')))

 

The error message helpfully gives the location of the issue (line 1, column 18164), but I have no idea how to find that location!

 

Can anyone give me advice on how to debug this?

1 REPLY 1
Super User
Super User

Use different variables and assign individual expression to variables...

 

Use Switch case if possible

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (51,403)