Thank you for the info!

I finally solved it by referencing the previous post!!
https://groups.google.com/forum/?fromgroups=#!searchin/web2py/Number$20format$20locale/web2py/51XIw3Lz74c/vLnyxa9gfmgJ

model
----------
import locale
locale.setlocale(locale.LC_NUMERIC, 'English')

def number_format(num, places=0): 
    return locale.format("%.*f", (places, num), True)

view
----------
     <td>{{=number_format(lists.ShipQty,0)}}</td>


On Friday, May 10, 2013 2:10:21 PM UTC-5, Niphlod wrote:
>
> represent is used in widgets only, it doesn't get called for "raw" 
> representations such as {{=record.column}}
>
> if you want to leverage your model's represent, you have to call it
> {{=db.table.column.represent(record.column, record)}}
>
> On Friday, May 10, 2013 6:57:48 PM UTC+2, Omi Chiba wrote:
>>
>> 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