Thanks everyone.  This does get me the results that I was looking for.

Seeing as I'd like to deploy this on GAE, I wondered if it might be
advisable to take this as an opportunity to learn how to use pyjamas
and pass along some of the work to javascript in the browser?

With that in mind, I was able to add a class to give me all the
pledges for a single pledge drive as a list of dictionaries:

http://code.google.com/p/pledgedrivetracker/source/browse/pledgedrives/controllers/default.py#451

I was able to test this in the python interactive shell using:

import xmlrpclib
s = xmlrpclib.ServerProxy('http://localhost:8000/pledgedrives/default/
call/xmlrpc/')
s.service_pledgedrive_pledges('1')

Do you know off-hand if pyjamas support xmlrpc, or will I have to do
this using jsonrpc?

Do you think this approach is a good tact to take or, from your
experience, do you think that I am heading down a blind alley?

Thanks!

JT



On Dec 4, 10:12 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
> I think this should do it:
>
> r = db(db.pledge.pledgedrive==pledgedrive_id).select
> (db.pledge.amount.sum())
> total=r[0]._extra[db.pledge.amount.sum()]
>
> It will not work on GAE.
>
> On Dec 4, 10:58 am, johntynan <jgty...@gmail.com> wrote:
>
> > I have a question about finding the sum of a specific field across the
> > results of an entire query
>
> > While this statement will return the total number (len) of records
> > returned in a query:
> > pledgedrive_total_pledges = len(db
> > (db.pledge.pledgedrive==pledgedrive_id).select())
>
> > I would like to get the total dollars (sum) of the "amount" field that
> > each of these records contains.
>
> > Thank you for your help.
>
> > JT
>
> > P.S. As an extra bonus, I am most pleased to discover the jquery ajax/
> > load script.  I may be saying goodbye to framesets for good:
>
> >http://code.google.com/p/pledgedrivetracker/source/browse/pledgedrive...
>
>

--

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.


Reply via email to