Page 1 of 1

Locale number formatting

Posted: 28.11.2006, 14:03
by desrocchi
Hi everyone,
I'm having problems with the function to_char in a query on postgresql 8.1.5 and Delphi 7 Pro.

There's this function in my query:

"trim(to_char(impo, '9G999G999G990D99'))"

this should return a number with locale (Italian) settings and works fine if I try this at designtime, but when I use it at runtime it puts a wrong thousand separator (a ",") while the decimal separator is right (always a ",").

ex:
Designtime trim(to_char(5432.66, '9G999G999G990D99'))
returns "5.432,66"

Runtime trim(to_char(5432.66, '9G999G999G990D99'))
returns "5,432,66"

I tried resetting the properties DecimalSeparator and ThousandSeparator right before opening the query but nothing changes.

Any clue?

Thanks,
Daniele

Posted: 28.11.2006, 14:07
by desrocchi
I forgot: I also updated Zeos to the last release 6.6.0 beta.

Daniele

Posted: 28.11.2006, 15:05
by btrewern
Try adding a ZSQLMonitor to your application and logging your queries. It may be that zeos adds something before your query runs.

Regards,

Ben

Posted: 28.11.2006, 15:29
by desrocchi
Hi,
I tried what you suggested but I can see no errors in the log:

2006-11-28 15.24.59 cat: Execute, proto: postgresql-8, msg: SELECT trim(to_char(impo, '9G999G999G990D99')) AS impox, * FROM q_rate

is there something I'm not doing right?

bye,
Daniele

Posted: 29.11.2006, 10:00
by desrocchi
I couldn't solve the problem so I took a different approach to obtain what I need:

I created a view that contains all the required fields plus the to_char function, this way when I query "SELECT * FROM view_table" the number is formatted the way I expect it to be.

bye,
Daniele