[web2py] Re: SQLTABLE: how to customise it?

2012-09-18 Thread Massimo Di Pierro
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
>>
>>

-- 





[web2py] Re: SQLTABLE: how to customise it?

2012-09-18 Thread maverick
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
>
>

-- 





[web2py] Re: SQLTABLE: how to customise it?

2010-02-02 Thread DenesL


On Feb 2, 2:00 pm, Stefan  wrote:
> Is there a way to expand the amount of characters in a field? I've
> noticed that SQLTABLE (or more specifically, gluon.html.TABLE) tends
> to truncate the amount of visible text. I'm attempting to us the
> plugin_datatable plugin to display data, but I can't seem to show the
> full contents of the record.
>
> Thanks!

SQLTABLE(..., truncate=x) # default is 16

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: SQLTABLE: how to customise it?

2010-02-02 Thread Stefan
Is there a way to expand the amount of characters in a field? I've
noticed that SQLTABLE (or more specifically, gluon.html.TABLE) tends
to truncate the amount of visible text. I'm attempting to us the
plugin_datatable plugin to display data, but I can't seem to show the
full contents of the record.

Thanks!

On Jan 23, 6:36 pm, mdipierro  wrote:
>     rows = db(query).select(db.sarua.ALL,limitby = (0,25))
>     records =SQLTABLE(rows, headers=dict([('sarua.'+f,db.sarua
> [f].label)
>                                     for f in db.sarua.fields]))
>     dict(records=records)
>
> On Jan 23, 4:55 pm, Johann Spies  wrote:
>
>
>
> > On 21 January 2010 16:08, mdipierro  wrote:
>
> > > massimo-di-pierros-macbook:web2py_jeeva mdipierro$ python web2py.py -S
> > > welcome
> > > ...
> >  help(SQLTABLE)
> > > classSQLTABLE(gluon.html.TABLE)
> > >  |  given a SQLRows object, as returned by a db().select(), generates
> > >  |  an html table with the rows.
> > >  |
> > >  |  optional arguments:
> > >  |
> > >  |  :param linkto: URL (or lambda to generate a URL) to edit
> > > individual records
> > >  |  :param upload: URL to download uploaded files
> > >  |  :param orderby: Add an orderby link to column headers.
> > >  |  :param headers: dictionary of headers to headers redefinions
>
> > > example
>
> > >SQLTABLE(rows,headers = {'table.field':'Label Field', })
>
> > I am sorry to bother you, but I do not understand it properly.
>
> > In my controller now I have:
>
> >     r =SQLTABLE(db(query).select(db.sarua.ALL,limitby = (0,25)))
> >     records = r(rows, headers=dict([('sarua.'+f,db.sarua[f].label)
> >                                     for f in db.sarua.fields]))
> >     dict(records=records)
>
> > And get the error:
>
> > NameError: global name 'rows' is not defined
>
> > So where and how do I do this?
>
> > Johann

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: SQLTABLE: how to customise it?

2010-01-21 Thread Johann Spies
Thanks!

2010/1/21 mdipierro :
>
> massimo-di-pierros-macbook:web2py_jeeva mdipierro$ python web2py.py -S
> welcome
> ...
 help(SQLTABLE)
> class SQLTABLE(gluon.html.TABLE)
>  |  given a SQLRows object, as returned by a db().select(), generates
>  |  an html table with the rows.
>  |
>  |  optional arguments:
>  |
>  |  :param linkto: URL (or lambda to generate a URL) to edit
> individual records
>  |  :param upload: URL to download uploaded files
>  |  :param orderby: Add an orderby link to column headers.
>  |  :param headers: dictionary of headers to headers redefinions
>
> example
>
> SQLTABLE(rows,headers = {'table.field':'Label Field', })
>
> On Jan 21, 7:36 am, 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
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>
>
>
-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py] Re: SQLTABLE: how to customise it?

2010-01-21 Thread mdipierro

massimo-di-pierros-macbook:web2py_jeeva mdipierro$ python web2py.py -S
welcome
...
>>> help(SQLTABLE)
class SQLTABLE(gluon.html.TABLE)
 |  given a SQLRows object, as returned by a db().select(), generates
 |  an html table with the rows.
 |
 |  optional arguments:
 |
 |  :param linkto: URL (or lambda to generate a URL) to edit
individual records
 |  :param upload: URL to download uploaded files
 |  :param orderby: Add an orderby link to column headers.
 |  :param headers: dictionary of headers to headers redefinions

example

SQLTABLE(rows,headers = {'table.field':'Label Field', })

On Jan 21, 7:36 am, 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
-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.