cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
satcan
New Member

Unable to add numbers from form in flow

I have six fields of data from the form which are string data type. I would like to get the sum of them, when I tried to do the add function I am getting the following error: "'The template language function 'add' expects its first parameter to be an integer or a decimal number. The provided value is of type 'String'." Can anyone please help me to find a solution for this. Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @satcan 

 

I've put this demo together using Forms which has worked. I tend to use variables to make my expressions easier, so I've created a variable for value 1, a variable for value 2, and then in the third variable I add the two values together.

 

Flow Adding from Forms.PNG

View solution in original post

4 REPLIES 4

Hi @satcan you need to wrap your string values inside an int() expression. This will cast the value to be an integer. If they're decimal values, then wrap it in a float() expression.

 

E.g. add(int(triggerBody()?['Value1']),int(triggerBody()?['Value2']))

Thank you @MattWeston365 , I am getting this error now: "Unable to process template language expressions in action 'Update_item_4' inputs at line '1' and column '2787': 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type."

Ok, bear with me I'll go and trial it. I'm on a train so my signal is dropping in and out.

Hi @satcan 

 

I've put this demo together using Forms which has worked. I tend to use variables to make my expressions easier, so I've created a variable for value 1, a variable for value 2, and then in the third variable I add the two values together.

 

Flow Adding from Forms.PNG

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

New Process Advisor Capabilities carousel.png

Read the blog for the latest news

Read the latest about new experiences and capabilities in the Power Automate product blog.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (3,339)