x = db.MyDatabase.Value*2
rows = db(db.MyDatabase.Value).select(x)
print rows[0][x]

On Thursday, 3 December 2015 16:24:14 UTC-6, Henk Hendricks wrote:
>
> Hello All, 
>
> Is there a DAL equivalent of "(Field1 * 2) as MyComputedField", which 
> possible in sqlite? 
> I've trouble addressing the fields in my queries with computations in 
> them. 
>
> While toying with computations in my DAL queries, I came across the 
> following particularity: 
>
> These generate an error: 
> db().select( -db.MyDatabase.Value) 
> db().select(-1 * db.MyDatabase.Value) 
>
> But this one doesn't, and just works as expected. 
> db().select(db.MyDatabase.Value* -1) 
>
> -- 
> Greetings, 
>
> Henk Hendricks 
>
>

-- 
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.

Reply via email to