will do. and report back promptly
Massimo Di Pierro <mailto:[email protected]> Saturday, July 21, 2012 2:17 PMYou are using web2py stable. groupby is only in trunk. In 5 minutes, try the nightly build.On Saturday, 21 July 2012 12:35:55 UTC-5, david.waldrop wrote: -- david.waldrop <mailto:[email protected]> Saturday, July 21, 2012 1:35 PM Massimo, it does not accept the groupby in theSQLFORM.grid. 1 2 3. 4. 5. 6. 7. 8. Traceback (most recent call last): File "gluon/restricted.py", line 205, in restrictedFile "C:/Users/david/My Projects/Miscelaneous/web2py/applications/COPSIS2_1/controllers/org.py" <http://127.0.0.1:8000/admin/default/edit/COPSIS2_1/controllers/org.py>, line 162, in <module>File "gluon/globals.py", line 175, in <lambda> File "gluon/tools.py", line 2679, in fFile "C:/Users/david/My Projects/Miscelaneous/web2py/applications/COPSIS2_1/controllers/org.py" <http://127.0.0.1:8000/admin/default/edit/COPSIS2_1/controllers/org.py>, line 88, in orgs_gridTypeError: grid() got an unexpected keyword argument 'groupby' -- Massimo Di Pierro <mailto:[email protected]> Saturday, July 21, 2012 1:31 PM My bad. Try this: count = db.auth_user.id.count() # bad hack count._tablename = 'auth_user' count.readable = True count.represent = None count.formatter = lambda value:value # end bad hack results= SQLFORM.grid(db.org <http://db.org/>,fields=[db.org.name <http://db.org.name/>, db.org.jurisdiction, db.org.otype, db.org.id <http://db.org.id/>, count], left=db.org.on(db.auth_user.org_ref==db.org.id <http://db.org.id/>), deletable=False, details=True, create=False, editable=False,orderby=db.org.name.upper(), groupby=db.org.id,maxtextlength=50, paginate=20, csv=False, searchable=False)return dict(results=results) On Saturday, 21 July 2012 12:10:45 UTC-5, david.waldrop wrote: -- david.waldrop <mailto:[email protected]> Saturday, July 21, 2012 1:10 PMMassimo, thanks, this made progress in that it now does't emit and error, but only shows one row (instead of the 18 records in the table) and the a count for the single row of 39 (which is the total # users in the system). What I need is 18 rows, one for each org, and the # of users for each org (typically between 1-10) with current data.How does the grid know when to reset count??? -- Massimo Di Pierro <mailto:[email protected]> Saturday, July 21, 2012 1:03 PM This syntax is not allowed:left=db.org.on(db.auth_user.org_ref==db.org.id <http://db.org.id/>).count()Try this instead: count = db.auth_user.org_ref.count() # bad hack count._tablename = 'auth_user' count.readable = True count.represent = None count.formatter = lambda value:value # end bad hack results= SQLFORM.grid(db.org <http://db.org/>,fields=[db.org.name <http://db.org.name/>, db.org.jurisdiction, db.org.otype, db.org.id <http://db.org.id/>, count], left=db.org.on(db.auth_user.org_ref==db.org.id <http://db.org.id/>), deletable=False, details=True, create=False, editable=False,orderby=db.org.name.upper(),maxtextlength=50, paginate=20, csv=False, searchable=False)return dict(results=results) On Saturday, 21 July 2012 11:41:24 UTC-5, david.waldrop wrote: --
--
<<inline: compose-unknown-contact.jpg>>

