-2

How can i put all the Rows value to cell

rows = db().select(i.INV_ITEMCODE, n.INV_NAME, orderby=i.INV_ITEMCODE, join=n.on(i.POS_TASKCODE == n.POS_TASKCODE))
for r in rows:
    code = str(r.db_i_item.INV_ITEMCODE)
    desc = str(r.db_i_name.INV_NAME)     
    row = [dict(rows=rows)]
    cell = [code, desc]
    row = [dict(cell=cell, id=str(+1))]
    records = []
    total = [] 
    result = None
    result = dict(records=str(total), total='1', row=row , page='1') #records should get the total cell
    return result

the RESULT return only ONE cell value dict: {'records': '[]', 'total': '1', 'page': '1', 'row': [{'cell': ['LUBS001', 'Hav. Fully Synthetic 1L'], 'id': '1'}]}

but the ROWS have the query:

Rows: db_i_item.INV_ITEMCODE,db_i_name.INV_NAME
LUBS001,Hav. Fully Synthetic 1L
LUBS002,Hav. Formula 1L
LUBS003,Hav. SF 1L
LUBS004,Hav. Plus 2T 200ML
LUBS005,Havoline Plus 2T 1L
LUBS006,Havoline Super 4T 1L
LUBS007,Havoline EZY 4T 1L
LUBS008,Delo Sports 1L
LUBS009,Delo Gold Multigrade 1L
LUBS010,Delo Gold Monograde 1L
LUBS011,Delo Silver 1L
LUBS012,Super Diesel 1L
LUBS013,Brake Fluid 250ML
LUBS014,Brake Fluid 500ML
LUBS015,Brake Fluid 1L
LUBS016,Texamatic ATF 1L
LUBS020,Coolant
LUBS21,Delo
PET001,DIESEL
PET002,SILVER
PET003,GOLD
PET004,REGULAR
PET005,KEROSENE

    

Claudiu
  • 206,738
  • 150
  • 445
  • 651
rasyel
  • 11

1 Answers1

0

got it :D

'items = db(q1 & q2 & search).select(i.INV_ITEMCODE, n.INV_NAME, m.INV_KIND, p.INV_PRICE, m.INV_DRTABLE, p.INV_PRICECODE, p.INV_ITEMCODEX, orderby=o) ri = 0 rows = []

    for ri, r in enumerate(items):
        if r.db_i_matrix.INV_KIND == 'W':
            kind = 'Wet'
        else:
            kind = 'Dry'
        cell = [ str(ri + 1), str(r.db_i_item.INV_ITEMCODE), str(r.db_i_name.INV_NAME), str(kind), str(r.db_i_price.INV_PRICE),
                 str(r.db_i_matrix.INV_DRTABLE), str(r.db_i_price.INV_PRICECODE), str(r.db_i_price.INV_ITEMCODEX)] 
        records = ri + 1
        rows += [dict(id=str(ri + 1), cell=cell)]
    ikind = dict(records=records, totals='1', rows=rows)'
rasyel
  • 11