What you trying to do, change the sign? Than do db(db.table.lft > 0).update(lft = db.table.lft * (-1))
The first term of an expression has to be a field as operator overloading does not work. On Wednesday, 28 May 2014 03:21:56 UTC-5, Marian wrote: > > I want to negate a value with this expression: > > db(db.table.lft > 0).update(lft = 0 - db.table.lft) > > but I get the following TypeError: > TypeError: unsupported operand type(s) for -: 'int' and 'Field' > > My workaround is: > db(db.table.lft > 0).update(lft = db.table.lft - db.table.lft - db.table.lft) > > > *It seems that update expression need to start with the field or do I miss > something?* > > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

