I don't know if it's intentional or an omission.  I have defined a Virtual 
Field in one of the table definitions like so:

db.define_table('t_sig_count',
                Field('f_jacket_no', type='string',
                      label=T('Jacket')),
                Field('f_quantity', type='integer',
                      label=T('Quantity')),
                Field('f_dept', type='string',
                      label=T('Department')),
                Field('f_title', type='string',
                      label=T('Title')),
                Field.Virtual('f_sig_count',
                      lambda row: 
db(row.t_sig_count.id==db.t_jack_sigs.f_jacket_id).select(db.t_jack_sigs.f_sig.max()).first()[db.t_jack_sigs.f_sig.max()],
                      label=T('Sig Count')),
                Field('f_comments', type='text',
                      label=T('Comments')),
                Field('created_on', type='date', default=request.now,
                      label=T('Date')),
                format='%(f_jacket_no)s',
                migrate=settings.migrate)

db.define_table('t_jack_sigs',
                Field('f_jacket_id', 'reference t_sig_count',
                      label=T('Jacket')),
                Field('f_sig', type='integer',
                      label=T('Sig')),
                Field('f_no', type='integer',
                      label=T('No.')),
                Field('created_on', type='date', default=request.now,
                      label=T('Date')),
                Field('f_shift', type='integer',
                      label=T('Shift')),
                Field('f_loc', type='string',
                      label=T('Loc.')),
                Field('f_comments', type='text',
                      label=T('Comments')),
                format='%(f_sig)s',
                migrate=settings.migrate)

As you can see, it finds a highest value of one field in a linked table. 
 It works just fine and displays a calculated value in a grid:

<https://lh5.googleusercontent.com/-SP1vhpLdNVc/U3S-Qsde6BI/AAAAAAAABfI/eQj_DKPxbtI/s1600/smartgrid_virt_F.png>
However, when I click on a View button to see that record virtual field and 
its value is nowhere to be found.

<https://lh4.googleusercontent.com/-5RqPZH83IG4/U3S-no6NBCI/AAAAAAAABfQ/h4YaBzT_3IY/s1600/smartgrid_virt_f_view.png>
So, my question is it why is it not displayed?

-- 
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/d/optout.

Reply via email to