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

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (1,847)