cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jbrit2020
Super User
Super User

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

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

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

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

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

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 (2,674)