cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
satcan
Level: Power Up

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
Super User
Super User

Re: Unable to add numbers from form in flow

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
Super User
Super User

Re: Unable to add numbers from form in flow

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

satcan
Level: Power Up

Re: Unable to add numbers from form in flow

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

Super User
Super User

Re: Unable to add numbers from form in flow

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

Super User
Super User

Re: Unable to add numbers from form in flow

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
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

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

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (4,736)