cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jbrit2020
Helper V
Helper V

Form Patching Decimals to SQL DB

Hello,

 

I'm facing an issue with a form where I have to submit a numeric value which can be decimals to the SQL DB and it's not handling it very well. If the column in the SQL DB is set to Decimal or Numeric, Powerapps throws an error saying it cannot convert NVARCHAR to Numeric, if the SQL DB Columns are set to Int, it saves the numbers but ignores the decimals...

 

How should I be handling the Decimals in powerapps as it seems to firmly believe (although i set the text format to numeric) that it should patch the numbers as NVARCHAR?

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User III
Super User III

Hi @jbrit2020 

Could it be the case that your fields were nvarchar to begin with, and you later changed them to decimal or int? If that's the case, have you you refreshed the data source?

If your source field is numeric, you should patch a numeric value, not a string value. To make sure that you're patching a number, you can call the value function against the input value that you want to save. For example,

Value(txtInputValueToPatch.Text)

View solution in original post

3 REPLIES 3
timl
Super User III
Super User III

Hi @jbrit2020 

Could it be the case that your fields were nvarchar to begin with, and you later changed them to decimal or int? If that's the case, have you you refreshed the data source?

If your source field is numeric, you should patch a numeric value, not a string value. To make sure that you're patching a number, you can call the value function against the input value that you want to save. For example,

Value(txtInputValueToPatch.Text)

View solution in original post

@timl that worked and was the solution for the main issue.

Afterwards I only had to deal with empty field submission which was also throwing he same error, to sort it I  forced the default of the field to be 0 and therefore never null.

 

Thanks for the help

timl
Super User III
Super User III

That's wonderful @jbrit2020 - glad you got that working!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (36,724)