(I posted this question here as well: 
https://stackoverflow.com/questions/61544049/the-virtual-fields-are-not-accessible-until-i-convert-my-records-to-a-list
)

The book here 
<http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Virtual-fields>
 
gives this example for virtual fields where total_price is a virtual (not 
calculated) field.

for row in db(db.item).select():
   print row.total_price


However when i do this my virtual fields are missing. All the non-virtual 
fields are present.

The only way i can get access to the virtual fields is to convert the 
records to a list ...

rows = db(db.Table.id>1).select()*.**as_list()*


I read Massimo say somewhere that virtual fields are only calculated after 
the select is done. So i cant filter on a virtual field. But this doesn't 
seem to relate to my situation.

What am I missing?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/60841b7f-13e6-4e4e-a200-534a0755cc4a%40googlegroups.com.

Reply via email to