Forum OpenACS Development: How can i display "formatted_price" with a comma between every three digits?

Hi,

Is anybody know how can i display "formatted_price" in ecommerce modul with a comma between every three digits? here is the command waht i'm using right now.

set the_price $123456.7879
set formatted_price [format "%0.0f" $the_price]
then "$the_price" is shown like this "$123456"

What i expect is "$123,456" So if anyone has an idea, please let me know.

Thanks.

You can try: set formatted_price [util_commify_number $the_price]. The procedure is available in 3.x but I'm not sure if it exists in 4.x...

hi

thanks for you advise. fainaly i made it. it must be the defaul proc for the "formatted_price", isn't it?

Yeah, util_commify_number will do the trick, but if you're getting the number from an Oracle query, you probably want to use Oracle's to_char function. E.g.:
SQL> select
  to_char(123456, '999,990.00')  as number_pretty
from dual;

NUMBER_PRET
-----------
 123,456.00
I dunno about with Postgres.
That works in PG too:
steve=# select to_char(123456, '999,990.00') as number_pretty;
 number_pretty
---------------
  123,456.00
(1 row)