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
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
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...
I have an idea! What if you stored any price values as an integer in the database instead of using a float?
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
Its a workaround indeed, but not optimal
Ask Chatgippity if it's ok to store price values as a float in a database
Why not?
Recommended threads
- Websites hosted on my appwrite sites hav...
Hello, all my websites hosted on appwrite sites are not running I am getting this message "This site can’t be reached drivehub.appwrite.network took too long t...
- Function global variables
when i create a top-level global variable in go or bun how will it behave? is the heap getting renewed on every execution or could i do some kind of temp. cachi...
- sh: vite: Permission denied
When installing the vue starter template as site and then adding DaisyUI, i get the error `sh: vite: Permission denied`. I also got this issue (with a fresh tem...