web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Display numbers with d...
Power Apps
Unanswered

Display numbers with decimals (Patch and sql)

(0) ShareShare
ReportReport
Posted on by 19

Hi all,

Please help me with the following: I have an app where I am able to select a specific month by using a dropdown list and a text input where I have to add a specific number (with decimals) for the month selected.

 

After introducing the number, I have a submit button that add the data in a SQL database by using the following formula: Patch('[DBO].[number]', {Month: Dropdown. Selected. Value, Number: Value(text input. Text)}).

 

The issue is that: I want to display in the same app the number that is added with 2 decimals (I was not able to display the number with 2 decimals until now). From what I see, the data is stored in SQL as int. Is there a way that I can display the number with the 2 decimals? Thanks a lot!!!

Categories:
I have the same question (0)
  • Verified answer
    v-xiaochen-msft Profile Picture
    on at

    Hi @Amelie ,

     

    Please change the Int data type to float data type in sql sever.

     

    Best Regards,
    Wearsky
    If my post helps, then please consider Accept it as the solution to help others. Thanks.

  • Amelie Profile Picture
    19 on at

    Hi, 

    Thank you for your reply!

    Do I have to run this query in SQL server: 

    ALTER TABLE DBO. Number
    ALTER COLUMN Number FLOAT(20,2)

    Also, if I want to add another column to this table containing the year, do I have to append the patch formula that I have? 

    Thank you again!

  • v-xiaochen-msft Profile Picture
    on at

    Hi @Amelie ,

     

    If you are not familiar with sql syntax, I suggest you to manually modify the data type directly in SQL Server Management Studio.

    v-xiaochen-msft_0-1614764147603.png

    v-xiaochen-msft_1-1614764217866.png

    At this time , this formula will work.

    Patch('[DBO].[number]', {Month: Dropdown. Selected. Value, Number: Value(text input. Text)})

     

    Best Regards,
    Wearsky
    If my post helps, then please consider Accept it as the solution to help others. Thanks.

     

  • timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    Hi @Amelie 

    Before you change your data type to float, can you confirm that you actually want to show your number with 2 decimals (as opposed to 2 digits)?

    To expand on the latter, let's suppose the user selects 6 from your drop-down list (eg June). You can keep the underlying data type of your month column as int, but you can display the month number in your app with 2 digits (eg, 06) using this formula:

    Text(6, "00")
  • Amelie Profile Picture
    19 on at

    To be more clear: I select a month, June, and I want to display for this month the number that was introduced (basically, this number is an index value (like a sales target) for June). Let's say that this number is 99.91. Now, when I display this number it shows only 99, and I want also to display the 2 decimals (.91).

    Hope that this is clear enough.

     

    Thanks!!

  • timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    @Amelie 

    Thanks for the clarification. I misunderstood your question. In this case, Wearsky is correct and his post above will give you the answers that you seek.

  • Amelie Profile Picture
    19 on at

    Thanks again for the info! I have one more question:

    After I changed the data type, I clicked save, but I received an error: "Saving changes is not permitted. The change you have made requires the following table to be dropped and re-created..". I searched online and it seems that I can change this option from the Tools menu by uncheck the box: Prevent saving changes that require the table to be re-created".

     

    My question is: if I uncheck this and save the changes that I've made, I will loose the data that I already have in the table? I have just few rows, but I don't want to loose them.

     

    Thank you!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard