What is the proper way to select all fields plus a few additional 
calculated fields? Here is my basic query with no calculated field

location = db(db.location.id == loc_id).select().first()


This query returns location as a <class 'gluon.dal.Row'> object with fields 
for the location table as attributes. With this I can access 
location.address for example.

Now to add calculated fields to get the geo spatial coordinates from the 
point field, I'm trying this:

location = db(db.location.id == loc_id).select(db.location.ALL,
                                          db.location.point.st_x().
with_alias('latitude'),
                                          db.location.point.st_y().
with_alias('longitude')).first()


Is this the proper way? This returns a <class 'gluon.dal.Row'> object with 
a "location" field (which is in turn also a Row object)  and "latitude" and 
"longitude" fields.

Now in order to access the address field I must do location.location.address

How can make it so I can access the fields like location.address and 
location.latitude?

-- 
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/groups/opt_out.

Reply via email to