hi, 

i want to use grouping and counting using sqlform grid.
while i'm searching and learning on this forum i made something like:

purchase_order_left = 
db.purchase_order_header.on(db.purchase_order_header.supplier==db.supplier.id)
#purchase_order_left = 
db.purchase_order_header.on(db.purchase_order_header.id>0 and 
db.purchase_order_header.supplier==db.supplier.id)
total_purchase_order = db.purchase_order_header.supplier.count()
total_purchase_order.tablename = 'purchase_order_header'
total_purchase_order.readable = True
total_purchase_order.represent = None
total_purchase_order.formatter = lambda value:value
total_purchase_order.label = T('Total Purchase Order')
total_purchase_order.table = db.purchase_order_header
purchase_order_fields=[db.supplier.id, db.supplier.salutation, 
db.supplier.first_name, db.supplier.last_name, 
   db.supplier.gender, db.supplier.phone, db.supplier.email, 
total_purchase_order]
def report_supplier_purchase_order():
grid=SQLFORM.grid(db.supplier, left=purchase_order_left, 
fields=purchase_order_fields, groupby=db.supplier.last_name,
  create=False, editable=False, deletable=False)
return locals()

the problem is the last data supplier always appear in the grid (even if 
the last data have an empty value(0)), how can i make the last data that 
have an empty value not appears in the grid?

thanks and best regards,
stifan

-- 
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 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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to