cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
ChazBolt
Level: Powered On

Invalid expression when using addHours as the ValueIfTrue

Here my expression for trying to set a time for a event. 

 

if(empty(body('Get_response_details')?['r402dc317ae7a44eb9d4d9c7a3350f08c']),, addHours(body('Get_response_details')?['r402dc317ae7a44eb9d4d9c7a3350f08c'], +5, 'hh:mm tt')

Basically, if this form section is empty, then paste nothing.

 

if it has something in it, take the number added (should be a time entered by the users) and add 5 hours to it, format it and then paste it in

 

But i keep getting told the expression is invalid.

 

Any advice?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Invalid expression when using addHours as the ValueIfTrue

Hi @ChazBolt,

 

First of all, there is a problem with the syntax, so the prompt "expression is invalid".

If the Expression you provided is what you are currently using, there are the following errors:

  1. The second parameter of if should be ‘’
  2. The end of the expression is missing a ")"

So your Expression should look like this:

if(empty(body('Get_response_details')?['rcf731d2436b346ff9676505e1b5c5221']),'',addHours(body('Get_response_details')?['rcf731d2436b346ff9676505e1b5c5221'],5,'hh:mm tt'))

Please take a try again.

 

Best Regards,

Barry

Community Support Team _ Barry
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

4 REPLIES 4
Community Support Team
Community Support Team

Re: Invalid expression when using addHours as the ValueIfTrue

Hi @ChazBolt,

 

First of all, there is a problem with the syntax, so the prompt "expression is invalid".

If the Expression you provided is what you are currently using, there are the following errors:

  1. The second parameter of if should be ‘’
  2. The end of the expression is missing a ")"

So your Expression should look like this:

if(empty(body('Get_response_details')?['rcf731d2436b346ff9676505e1b5c5221']),'',addHours(body('Get_response_details')?['rcf731d2436b346ff9676505e1b5c5221'],5,'hh:mm tt'))

Please take a try again.

 

Best Regards,

Barry

Community Support Team _ Barry
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

ChazBolt
Level: Powered On

Re: Invalid expression when using addHours as the ValueIfTrue

I tried that as well and got the same error.
Community Support Team
Community Support Team

Re: Invalid expression when using addHours as the ValueIfTrue

Hi @ChazBolt,

 

Provide the Expression you are configuring currently.

Maybe you didn't notice some details.

71.PNG

if(not(empty(body('Get_response_details')?['rcf731d2436b346ff9676505e1b5c5221'])),addHours(body('Get_response_details')?['rcf731d2436b346ff9676505e1b5c5221'],5,'hh:mm tt'))

 

I am using it on my side and there are no errors.

 

Regards,

Barry

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ChazBolt
Level: Powered On

Re: Invalid expression when using addHours as the ValueIfTrue

I tried this again and got it work! must have been my syntax. 

 

thanks!

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons in April

Read the announcement for more information!

firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (7,739)