Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Setting Decimal Precision on Edit Form Input

(0) ShareShare
ReportReport
Posted on by 14

Hello everybody.

 

I am working with a Form that is attached to a SQL connection, which was used to create the fields within the form (so numeric vs. text vs. bit, etc.).

 

I am trying to figure out a way to setup decimal precision on the input side, because I need the numbers to be transferred to SQL with the correct amount of precision because the data is then being pulled from SQL into PowerBI.

 

For example, one of my fields is "pH", and is technically a Text Input with the Format property set to TextFormat.Number. I need to set it up so that when the user enters a number (let's say "6"), it automatically adds a precision of one decimal place ("6.0"). Or, if they enter "6.75", it rounds to "6.8".

 

I have seen numerous ways to do this on the return (in a ViewForm), but none for submitting or editing data via an EditForm.

 

Thanks and let me know if I can clarify anything!

Categories:
  • Adamjs11 Profile Picture
    Adamjs11 14 on at
    Re: Setting Decimal Precision on Edit Form Input

    @Drrickryp 

     

    That makes sense, but I would prefer for just the input box to show what the recorded value would be, instead of having the number appear twice, as I feel that would clog my form up with extras. Here is what my input looks like now:

     

    Input.PNG

    After the user either clicks off of it, I'd like that to add the precision of one decimal place, or round it if decimals already exist.

  • Drrickryp Profile Picture
    Drrickryp on at
    Re: Setting Decimal Precision on Edit Form Input

    I would probably change the DataCardKey from Parent.DisplayName to the 

     

    Parent.DisplayName &" will be recorded as "& RoundDown(DataCardValue1.Text, 6)

    That would show the user in real time what the value would be.  Why wait?

     

  • Adamjs11 Profile Picture
    Adamjs11 14 on at
    Re: Setting Decimal Precision on Edit Form Input

    @Drrickryp 

     

    That is a great solution and immensely helpful as it will allow me ensure that the numbers are rounded on transfer, thank you!

     

    Do you (or anyone else) know of a way that I can update the input on screen so (perhaps utilizing the "OnChange" property), so that my users can also see the rounded numbers before they submit the form? 

  • Drrickryp Profile Picture
    Drrickryp on at
    Re: Setting Decimal Precision on Edit Form Input

    @Adamjs11 

    This would be done in the Update property of the data card containing the TextInput box.  Where normally it would just say something like DataCardValue1.Text, change it to Round(DataCardValue1.Text,6), for example to round it up or down to 6 decimal places.   

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,526

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,907

Leaderboard