I'm trying to display ShipQty field value with correct number format such 
as 1,500 but it shows 1500. I don't know if my represent statement is wrong 
or because I'm using bootstrap table style... 


model
----------------
db.define_table('shipping',
    Field('FullOrderNumber', length=11, label='Order#'),
    Field('ShipDate', 'date', label='Shipped On'),
    Field('ShipNumber', length=12, label='Shipping#'),    
    Field('ShipQty', 'decimal(9,0)', label='Shipped Qty',represent = lambda 
ShipQty,row: '%.2f' % ShipQty),
    Field('DeliveryMethod', length=30, label='Delivery Method'),
    Field('TrackingNumber', length=20, label='Tracking#'),
    Field('UpdatedDate', 'date', label='Updated On'),
    )

control
----------------
    key = request.args(0) or redirect(URL('index'))  
    query = (db.shipping.FullOrderNumber==key)
    lists = db(query).select(db.shipping.ALL)    

view
---------------
          <table class="table table-hover">
            <thead>
                <th>Order#</th>
                <th>Status</th>
                <th>Part#</th>
                <th><span class='right'>Order Qty</span></th>
                <th><span class='right'>Shipped Qty</span></th>
                <th>Tracking#</th>
  </thead>
            <tbody>
            {{for orders in orders:}}
    <tr>
    <td>{{=orders.FullOrderNumber}}</td>
        <td>{{=orders.StatusDesc}}</td>
        <td>{{=orders.PartNumber}}</td>
                        <td><span 
class='right'>{{=orders.OrderQty}}</span></td>
                        <td><span 
class='right'>{{=orders.ShipQty}}</span></td>
        <td><a href="{{=URL('tracking',args=orders.FullOrderNumber)}}" 
class="btn">Click</a></td>
        </tr>
    {{pass}}
            </tbody>
</table>

-- 

--- 
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.


Reply via email to