cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted

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





Did my reply help? Please give it a thumbs up.
Did I answer your question? Please mark my post as a solution!
If you liked my response, please consider giving it a thumbs up. THANKS!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

View solution in original post

4 REPLIES 4
Highlighted
Super User
Super User

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']))





Did my reply help? Please give it a thumbs up.
Did I answer your question? Please mark my post as a solution!
If you liked my response, please consider giving it a thumbs up. THANKS!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

Highlighted

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."

Highlighted

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





Did my reply help? Please give it a thumbs up.
Did I answer your question? Please mark my post as a solution!
If you liked my response, please consider giving it a thumbs up. THANKS!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

Highlighted

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





Did my reply help? Please give it a thumbs up.
Did I answer your question? Please mark my post as a solution!
If you liked my response, please consider giving it a thumbs up. THANKS!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

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.

Top Solution Authors
Top Kudoed Authors
Users online (9,427)