[web2py] dal aggregation sum fields None

2011-10-22 Thread apple
I am summing some data using the DAL: cash_price = db.orderline.cash_price.sum() lines = db(db.orderline.order_ == id).select(cash_price).first() However if there are no lines then lines[cash_price] is None. So I added: lines[cash_price]=lines[cash_price] or 0 But this does not

Re: [web2py] dal aggregation sum fields None

2011-10-22 Thread Bruno Rocha
for me it is a case for coalesce in pure SQL. I know dal offers coalesce support but I did not try yet. http://zerp.ly/rochacbruno Em 22/10/2011 09:47, apple simo...@gmail.com escreveu: I am summing some data using the DAL: cash_price = db.orderline.cash_price.sum() lines =