Re: [web2py] Re: Sum/Total of the column values in SQLFROM.grid?

2018-07-26 Thread sandeep patel
Thank Anthony, The error was getting just because I used {{=sum(b)}} in my view. now this works fine. Best On Thu, Jul 26, 2018 at 5:12 PM Anthony wrote: > On Thursday, July 26, 2018 at 7:39:05 AM UTC-4, sandeep patel wrote: >> >> @Anthony, This gives me an error.becouse of some values float

Re: [web2py] Re: Sum/Total of the column values in SQLFROM.grid?

2018-07-26 Thread Anthony
On Thursday, July 26, 2018 at 7:39:05 AM UTC-4, sandeep patel wrote: > > @Anthony, This gives me an error.becouse of some values float type in the > field. > > ('float' object is not iterable) > How can I successfully sum all the values within this solution? > Please show your exact code and

Re: [web2py] Re: Sum/Total of the column values in SQLFROM.grid?

2018-07-26 Thread sandeep patel
@Anthony, This gives me an error.becouse of some values float type in the field. ('float' object is not iterable) How can I successfully sum all the values within this solution? Thanks On Thu, Jul 26, 2018 at 4:09 PM Anthony wrote: > #controller.py >> >> grid = SQLFROM.grid(query,..,...) >>

Re: [web2py] Re: Sum/Total of the column values in SQLFROM.grid?

2018-07-26 Thread Anthony
> > #controller.py > > grid = SQLFROM.grid(query,..,...) > a = grid.__dict__ > b = sum([int(i.number_of_bags) for i in a['dbset'].select()]) > > This is more efficient because the database calculates the sum for you and you don't have to load all of the database records into the web2py process:

Re: [web2py] Re: Sum/Total of the column values in SQLFROM.grid?

2018-07-25 Thread sandeep patel
Thanks to all for your support @Anthony, I have done this way!! That provie all values sum which is having in grid. #controller.py grid = SQLFROM.grid(query,..,...) a = grid.__dict__ b = sum([int(i.number_of_bags) for i in a['dbset'].select()]) Please, Let let me know if any other way to do

[web2py] Re: Sum/Total of the column values in SQLFROM.grid?

2018-07-25 Thread Anthony
On Wednesday, July 25, 2018 at 5:41:26 PM UTC-4, Anthony wrote: > > On Wednesday, July 25, 2018 at 3:49:09 PM UTC-4, pbreit wrote: >> >> How about JavaScript? >> >> >> https://www.oreilly.com/library/view/javascript-cookbook/9781449390211/ch04s07.html >> > > Having the database do it is most

[web2py] Re: Sum/Total of the column values in SQLFROM.grid?

2018-07-25 Thread Anthony
On Wednesday, July 25, 2018 at 3:49:09 PM UTC-4, pbreit wrote: > > How about JavaScript? > > > https://www.oreilly.com/library/view/javascript-cookbook/9781449390211/ch04s07.html > Having the database do it is most efficient -- you neither have to get all the data from the database into the

[web2py] Re: Sum/Total of the column values in SQLFROM.grid?

2018-07-25 Thread pbreit
How about JavaScript? https://www.oreilly.com/library/view/javascript-cookbook/9781449390211/ch04s07.html -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) ---

[web2py] Re: Sum/Total of the column values in SQLFROM.grid?

2018-07-24 Thread Anthony
You should do a separate query and have the database calculate the sum for you (rather than loading all the records from the database and doing the calculation in Python). Anthony On Tuesday, July 24, 2018 at 3:08:12 PM UTC-4, sandeep patel wrote: > > Hello, > I have a grid that is worked as I