mkurth
|
| Posted: 03/26/2002, 6:40 AM |
|
Using the BookStore|Shopping-Cart Sub-Total and Total Labels as an example, how does one Format the Labels to only display 2 decimal places?
|
|
|
 |
Alex Alexapolsky
|
| Posted: 03/26/2002, 7:17 AM |
|
You need to use vbscript FormatNumber function in Before Show event for
field variable, e.g. fldprice = FormatNumber(fldprice)
|
|
|
 |
mkurth
|
| Posted: 03/26/2002, 8:40 AM |
|
Thanx for your response. I didn't mention I'm using php4. Based on the earlier thread re: Currency in PHP, I tried the following on the ShoppingCart page: $sub_total = "$".number_format($sub_total, 2, ".", ","); I placed it in the before_show event, but got same results of alot of decimals. The difference I see in this field and others on the Form is that it is a calculated field from the sql_statement in the Total|SQL Use_SQL_String option. Fields straight from Tables seem to display the desired 2 decimals. I also tried this function in it's default state without the Currency options, but no better.......
|
|
|
 |
Nicole
|
| Posted: 03/27/2002, 12:41 AM |
|
Hello,
I think you just use incorrect field name and function isn't applied to real field. Check what is field name (see field properties->common tab 'Name' field). Variable name for table field is: $fldfield_name
E.g. the name is sub_total, then format number code should be:
$fldsub_total = "$".number_format($fldsub_total, 2, ".", ",");
|
|
|
 |
mkurth
|
| Posted: 03/27/2002, 9:37 AM |
|
Adding the "fld" in between the $ and the field_name did the trick for the number_format() Function.... Thanks Nicole !
|
|
|
 |
|