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





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

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

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.





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

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
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (934)