unless there is a bug, Field('name','decimal(5,2)') will always treat the number as decimal.Decimal at the web2py level. The problem is how is it stored in the database. If the database supports decimal is it stored accordingly. If the database does not (sqlite) that it is converted to float and stored as float.
I am not sure I answered the question. perhaps I misunderstood. On Jun 17, 12:54 pm, apple <simo...@gmail.com> wrote: > Yes sqlite. > > The book says "SQLite does not handle the decimal type so internally > we treat it as a double". However wouldn't it be logical to convert it > back to decimal if that is what my tabledef says? > > On Jun 17, 6:40 pm, Anthony <abasta...@gmail.com> wrote: > > > > > > > > > On Friday, June 17, 2011 1:13:26 PM UTC-4, apple wrote: > > > > I am using the DAL to aggregate SUM a decimal field and the result is > > > a float. Shouldn't the DAL keep it in same format as the underlying > > > field? > > > Are you using SQLite? As far as I know, it doesn't support decimal fields, > > so I think web2py has to treat them as doubles. > > Seehttp://web2py.com/book/default/chapter/06#DAL,-Table,-Field. > > > Anthony