Should not be
*{...., 'hvmt2.bytes_total.sum()'*:'USAGE in MB'}
but
{....., str(db.*hvmt2.bytes_total.sum())*:'USAGE in MB'}
On Tuesday, 18 September 2012 01:23:58 UTC-5, maverick wrote:
>
> How do I give a label to calculated fields, like if I used:
>
> rows = db().select(db.hvmt2.hub,db.*hvmt2.bytes_total.sum()*,
> groupby=db.hvmt2.hub, cacheable=True)
>
> I want to serialize rows as:
>
> Result=SQLTABLE(rows,headers={'hvmt2.hub':'HUB',*'hvmt2.bytes_total.sum()'
> *:'USAGE in MB'},truncate=60)
>
> But the summed column (what I referred to above as 'calculated') gets
> displayed as SUM(hvmt2.bytes_total) not 'USAGE in MB' as I desire.
>
> Thanks,
> mave
>
> On Thursday, January 21, 2010 5:36:17 AM UTC-8, Johann Spies wrote:
>>
>> I would like the table produced by SQLTABLE to have different column
>> labels (e.g. "Name" for "db.person.name"). How do I do it?
>>
>> Also: I would like the output of SQLTABLE to provide links to
>> individual records simliar to what appadmin does. I could not fully
>> understand the code appadmin uses to achieve this.
>>
>> Can linkto be used in this case? From what I understand from te book
>> linkto is a SQLFORM method and is not related to SQLTABLE.
>>
>> Regards
>> Johann
>>
>>
--