I don't want to store 123.123, I want 99.99 max.

The problem is that no validator is triggered when entering 123.123...

Richard

On Wed, Nov 17, 2010 at 11:53 AM, villas <[email protected]> wrote:

> Hi Richard
>
> It might depend on the DB,  but I believe you would normally need at
> least decimal(5,2) to contain 123.456789
> With decimal(4,2) I think the max value would be 99.99...
>
> Try it...  :)
>
> -D
>
>
> On Nov 17, 3:44 pm, Richard Vézina <[email protected]>
> wrote:
> > I forgot to precise that I am under 1.88.2
> >
> > Thanks
> >
> > On Wed, Nov 17, 2010 at 10:43 AM, Richard Vézina <
> >
> > [email protected]> wrote:
> > > Hello,
> >
> > > I wonder if it is normal that I get ticket in that case :
> >
> > > Model :
> >
> > > Field('field1','decimal(4,2)'),
> >
> > > If I insert in form generate with crud.create(db.table1) this value :
> > > 123.123
> >
> > > I get ticket :
> >
> > > Error traceback
> >
> > > 1.
> > > 2.
> >
> > > 3.
> > > 4.
> >
> > > 5.
> > > 6.
> >
> > > 7.
> > > 8.
> >
> > > 9.
> > > 10.
> >
> > > 11.
> > > 12.
> >
> > > 13.
> > > 14.
> >
> > > 15.
> > > 16.
> >
> > > 17.
> > > 18.
> >
> > > 19.
> > > 20.
> >
> > > 21.
> >
> > > Traceback (most recent call last):
> >
> > >   File "/web2py/gluon/restricted.py", line 188, in restricted
> >
> > >     exec ccode in environment
> >
> > >   File "/web2py/applications/app/controllers/test.py", line 552, in
> <module>
> >
> > >   File "/web2py/gluon/globals.py", line 96, in <lambda>
> >
> > >     self._caller = lambda f: f()
> >
> > >   File "/web2py/gluon/tools.py", line 2270, in f
> >
> > >     return action(*a, **b)
> >
> > >   File "/web2py/applications/app/controllers/test.py", line 372, in
> update
> >
> > >     if form.accepts(request.vars, session):
> >
> > >   File "/web2py/gluon/sqlhtml.py", line 1144, in accepts
> >
> > >     self.table._db(self.table.id == self.record.id).update(**fields)
> >
> > >   File "/web2py/gluon/sql.py", line 3484, in update
> >
> > >     self._db._execute(query)
> >
> > >   File "/web2py/gluon/sql.py", line 1026, in <lambda>
> >
> > >     self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
> > > DataError: ERREUR:  champ numérique en dehors des limites
> >
> > > DETAIL:  Un champ de précision 4 et d'échelle 2 doit être arrondi à une
> valeur
> >
> > > absolue inférieure à 10^2.
> >
> > > I thought that the validator will show up a error...
> >
> > > Do I have to use IS_DECIMAL_IN_RANGE and why since I precised the
> decimal
> > > limit in the model???
> >
> > > Regards.
> >
> > > Richard
> >
> >
>

Reply via email to