I hear you and I agree about that... I am just supprise that we have no
control over rouding of what goes in the database as it is very critical in
some use case with weird rounding spec that you could have in academic
sometime for instance.

At some point I had extend field "length" to 10 places that way I was not
having to refactor fields parameters as client change of idea and just
round the data at retrieving so it might be the way to go about that.

This is as easy as :

represent=lambda value, row: '{0:.2f}'.format(value) if value else T('N/A')

It could might be more efficient if we configure it at Decimal quantize
level, but I think you have to maniuplate it for each field so it might
come to the same computing resource required.

Richard

On Fri, Apr 20, 2018 at 3:29 PM, Anthony <abasta...@gmail.com> wrote:

> On Friday, April 20, 2018 at 3:06:59 PM UTC-4, Richard wrote:
>>
>> 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...
>>
>
> Well, if you let the DAL create the table in the database, then you do get
> values with the specified number of places. If not, there is nothing web2py
> can do to affect what is stored in the database. I suppose web2py could
> round the data once selected from the database. Maybe submit a Github issue.
>
> 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.

Reply via email to