It maybe just me, but I kind of think that if my models says decimal(10, 2) it means that I don't want to store more than 2 places... Since my models should behave like the database table and column as they are just an abstraction of the later...
I know web2py offer alot of granularity control and flexibility over all this aspect, but I feel that there is a missing component to handle this particular aspect (rounding and enforcing "length" of numeric fields). Richard On Fri, Apr 20, 2018 at 2:59 PM, Anthony <abasta...@gmail.com> wrote: > On Friday, April 20, 2018 at 2:36:58 PM UTC-4, Richard wrote: >> >> It appears that it get silently "cropped/rounded" by the backend field >> type configuration... If I have field with 2 places in the backend and 3 >> places defined in the models and input 0.647, it will be stored as 0.65. >> >> Do we have control over the rounding in web2py or it configure in the >> database engine?? >> > > web2py has no control over what the database does (other than its ability > to initially define the precision of the database column if web2py is used > for a migration to create the database table). So, first make sure your > database column is defined with the decimal precision you want. > > On the web2py side, you can control the precision of the inputs however > you want -- web2py will simply pass those inputs to the database. > > Anthony > > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.