Skip to content
Back

float

  • 0
  • 2
  • Self Hosted
  • Databases
Gerardo
11 Dec, 2025, 16:32

Hello everyone, So, I created a column of type float with the min and required options, I noticed that it wouldn't let me set a 2 decimal points for the min value like 0.25. 😵 So I left it as 0.2 Then when I tried to create a row it was the same issue. Bottom line is this thing would not let me set a float even with a 2 decimal position. and the error I get is the following :

Please enter a valid value. The two nearest valid values are 0.2 and 0.3. I've seen some posts with this exact error but in previous versions https://github.com/appwrite/appwrite/issues/2764 https://github.com/appwrite/appwrite/issues/2614

is there a workaround for this issue?

Thanks in advance I'm using ubuntu, and appwrite:1.8.0 self hosted

TL;DR
Use integers to store money values in the smallest currency unit (e.g., cents) to avoid rounding issues. For example, store $0.25 as 25 and $14.75 as 1475 in the database. This allows for precise handling by dividing by 100 on the client side. Storing prices as floats in the database is not optimal. Ask Chatgippity for approval before making changes.
11 Dec, 2025, 17:06

For any money, use an integer but store the value in the smallest currency for whatever country you're doing transactions in. So if you're doing USD, do "priceInCentsPerBotella" and then you can simply store it as 25. If something is $2.00 you can store it as 200 (cents/pennies) and that way you can avoid rounding issues

11 Dec, 2025, 17:48

So, I've being trying multiple things :

  • Leaving the min field blank and it lets me set 0.25 which means I would have to rely only on the client for validations which is not good.
  • Also tried to add a row with the initial constraints of 0.2 and then editing the row in the spreadsheet and it actually saves the values So I would hope that this behavior also propagates to the client SDK or otherwise I'm fried...
11 Dec, 2025, 17:56

I have an idea! What if you stored any price values as an integer in the database instead of using a float?

11 Dec, 2025, 17:58

On the client you can divide by 100 and get that exact precision

$0.25 - store it as 25 in the database $14.75 - store it as 1475 in the database

And then you can set your min/max down to the penny

1
11 Dec, 2025, 18:12

Its a workaround indeed, but not optimal

11 Dec, 2025, 18:13

Ask Chatgippity if it's ok to store price values as a float in a database

11 Dec, 2025, 21:49

Why not?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more