cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Template add function expect its first parament to be integer or a decimal number, while the provided value is of type string; how to solve

Looking for assistance/quidance for the following error message to solve it

 

Unable to process template language expressions in action 'Set_variable' inputs at line '1' and column '2223': 'The template language function 'add' expects its first parameter to be an integer or a decimal number. The provided value is of type 'String'. Please see https://aka.ms/logicexpressions#add for usage details.'.

 

Thanks and best regards

Arthur

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Template add function expect its first parament to be integer or a decimal number, while the provided value is of type string; how to solve

Hello @arthcras

You will have to convert the string number to a integer or a float depending on if it’s whole number or a decimal. To do this:

Add a compose action,
Inside the compose, use the expression int() or float() depending on if it’s whole number or decimal.
Inside the ( ) put the dynamic content of the string number (this is the first parameter)

Now inside your set variable reference the compose for the first parameter.

Basically wherever you are getting this value from, is not a number to start. It’s type string. Meaning the original value might be “2” and you need it to be 2 without quotes. Quotes makes the code think it’s a string.




Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips, tricks, and guides
FlowAltDelete




View solution in original post

4 REPLIES 4
Highlighted
Super User III
Super User III

Re: Template add function expect its first parament to be integer or a decimal number, while the provided value is of type string; how to solve

Hello @arthcras

You will have to convert the string number to a integer or a float depending on if it’s whole number or a decimal. To do this:

Add a compose action,
Inside the compose, use the expression int() or float() depending on if it’s whole number or decimal.
Inside the ( ) put the dynamic content of the string number (this is the first parameter)

Now inside your set variable reference the compose for the first parameter.

Basically wherever you are getting this value from, is not a number to start. It’s type string. Meaning the original value might be “2” and you need it to be 2 without quotes. Quotes makes the code think it’s a string.




Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips, tricks, and guides
FlowAltDelete




View solution in original post

Highlighted
Frequent Visitor

Re: Template add function expect its first parament to be integer or a decimal number, while the provided value is of type string; how to solve

Thanks for the reply

The begin situation is as follows

 

1 Manual trigger a flow

2. Get items (sharepoint)

3 Initialize variable (set on float)

4. Apply to each (set variable) 

 

formule

add(items('Apply_to_each') ['GrossRiskS'], variables ('TotalAverageGrossScore'))

 

where do i have to put the compose action

Highlighted
Super User III
Super User III

Re: Template add function expect its first parament to be integer or a decimal number, while the provided value is of type string; how to solve

Hello @arthcras 

 

Since you gave me your expression, we can try and simplify it by using the expression directly.

Try one of these:

If your GrossRiskS value is an Integer or a whole number use:

 

add(int(items('Apply_to_each') ['GrossRiskS']), variables ('TotalAverageGrossScore'))

 

 

If the value is a decimal use:

 

add(float(items('Apply_to_each') ['GrossRiskS']), variables ('TotalAverageGrossScore'))

 

 

 

Let me know if there are any errors.





Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips, tricks, and guides
FlowAltDelete




Highlighted
Frequent Visitor

Re: Template add function expect its first parament to be integer or a decimal number, while the provided value is of type string; how to solve

Hello

This issue solved on the way as you suggested

Thank you

best regards

Arthur

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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!

Top Solution Authors
Users online (8,640)