Try to fetch it without 'virtual' just use Row.fieldname instead of
Row.virtual.fieldname

It depends on how did you set the virtualfields, if you do
Rows.setvirtualfields(virtual=someClass()) you'll get a sub dictionary for
every row and you need to use 'virtual' to access it, I think this works in
this way because you are defining virtualfields after the Rows object.

If you do it before with: db.table.virtualfields.append(someClass()) it
works in another way.

Take a look at virtual fields on the book:
http://web2py.com/book/default/chapter/06#Virtual-Fields

Bruno


2010/12/30 Kenneth Lundström <kenneth.t.lundst...@gmail.com>

>  I´m still trying to understand the power of powerTable and copied code
> from your default.py example, I tried to get the products function working.
> What I can´t seem to get working is the virtual bit.
>
> I get KeyError: 'virtual' any ideas why?
>
>
> Kenneth
>
>
>
>
> 2010/12/29 Kenneth Lundström <kenneth.t.lundst...@gmail.com>
>
>> Hi Bruno,
>>
>> waauu what a Plugin your working on, very nice.
>>
>> What does the productdetails function look like?
>
>
>  In the main table every row has two attributes
>
>  ID = it is the record id from rows object, if there is not an id field it
> will be the first row value.
> Key = tablename.fieldname to query against
>
>  In that example the category table is passing i.e:
> key=products.category.1 cols=[a list of columns to fetch in detail]
>
>  the productdetails functions just splits the key and creates a new
> SQLTABLE
>
>  <example>
> def productdetails():
>  tablename,fieldname,value = key.split('.')
> return
> SQLTABLE(powertable_db(powertable_db.tablename.fieldname==value).select(**cols))
> </example>
>
>  Following this model it is possible to do whatever you need, bulld any
> html object to return in detail table, by default, wthout writing any code i
> can return a update/insert FORM, a TABLE, a UL list.
>
>  Now I am trying to include tabs within details to return multiple
> objects.
>
>  --
>
>  Bruno Rocha
> http://about.me/rochacbruno/bio
>
>
>


-- 

Bruno Rocha
http://about.me/rochacbruno/bio

Reply via email to