cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jbrit2020
Continued Contributor
Continued Contributor

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)

jbrit2020
Continued Contributor
Continued Contributor

@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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (3,048)