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
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
@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,..,...)
>>
>
> #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:
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
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
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
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)
---
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
9 matches
Mail list logo