The virtual fields are not accessible until I convert my records to a list

20 views
Skip to first unread message

Andrew Rogers

unread,
May 1, 2020, 10:09:50 AM5/1/20
to web2py-users

The book here 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?

Andrew Rogers

unread,
May 1, 2020, 10:20:13 AM5/1/20
to web2py-users
Ugg, I'm a goose. Silly mistake. It works exactly as it should. Sadly i dont.
Reply all
Reply to author
Forward
0 new messages