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
- CLI - get Database Totals
Is there a way with the Appwrite CLI to get table row totals (count)❓
- relationships bug or error idk
hey every one, am using am using appwrite on a project and ran into a problem where by created a relationship and two way to be specific and it is stuck on proc...
- Is permission changes tied to the column...
Hi, I'm evaluating appwrite for a project and through reading the documentation (I haven't coded/tested anything yet, just trying to have a grasp of the basic f...