this should have been fixed already on the latest trunk.... On Sunday, July 21, 2013 3:33:51 PM UTC+2, Jim S wrote: > > Just upgraded to latest trunk, Version > 2.6.0-development+timestamp.2013.07.20.12.59.52. > > Having a problem with SUM statements that previously worked. > > If the query returns no rows, then I'm getting this traceback: > > Traceback (most recent call last): > File "C:\dev\web2py\gluon\restricted.py", line 212, in restricted > exec ccode in environment > File "C:/dev/web2py/applications/ibc/controllers/dashboard.py" > <http://127.0.0.1:8000/admin/default/edit/ibc/controllers/dashboard.py>, line > 2035, in <module> > File "C:\dev\web2py\gluon\globals.py", line 193, in <lambda> > self._caller = lambda f: f() > File "C:/dev/web2py/applications/ibc/controllers/dashboard.py" > <http://127.0.0.1:8000/admin/default/edit/ibc/controllers/dashboard.py>, line > 1094, in contract_fees_ytd_by_distributor > > (db.national_sales_data.Invoice_Print_Date__c<=to_date)).select(processing_fees_sum).first()[processing_fees_sum] > or 0 > File "C:\dev\web2py\gluon\dal.py", line 6888, in __getitem__ > return ogetattr(self, key) > AttributeError: 'Row' object has no attribute > 'SUM(national_sales_data.Processing_Fees__c)' > > My code is: > > processing_fees = > db((db.national_sales_data.Invoice_Print_Date__c>=from_date) & > (db.national_sales_data.Trading_Partner_ID__c==trading_partner) & > (db.national_sales_data.Invoice_Print_Date__c<=to_date)).select(processing_fees_sum).first()[processing_fees_sum] > > or 0 > > Previously this would return 0 if there were no rows selected in the query. > > -Jim > >
-- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.