Negative Currency field formaat (?)
Hi,
I have a report that displays a currency saldo that is sometimes
negative.
I tried to use the following formats, but the values are still always
displayed the same way:
$#,0.00;($#,0.00) --> I expect something like (?123,23)
$#,0.00;-$#,0.00 --> I expect something like - ?123,23
But I always get this --> ?123,23 -
With the "min" on the right side.
The DB field as a "Currency" type.
Am I doing something wrong?
Thankx
Chantal M.
I have a report that displays a currency saldo that is sometimes
negative.
I tried to use the following formats, but the values are still always
displayed the same way:
$#,0.00;($#,0.00) --> I expect something like (?123,23)
$#,0.00;-$#,0.00 --> I expect something like - ?123,23
But I always get this --> ?123,23 -
With the "min" on the right side.
The DB field as a "Currency" type.
Am I doing something wrong?
Thankx
Chantal M.
This discussion has been closed.
Comments
---------------------------------------------
Article: Currency Formatting in ReportBuilder
---------------------------------------------
Currently when formatting currency display formats, ReportBuilder internally
calls FloatToStrF with a ffCurrency paramter.
This honors the Windows currency settings.
There are two ways to override this behavior:
1. Create a descendant of TppDisplayFormat.
See ppDisplayFormat.pas. YOu can easily create a descendant of
TppDisplayFormat and specify that your TmyDisplayFormat be used by
ReportBuilder to perform formatting. See the initialization section
ppDisplayFormat.pas.
2. Override the Window currency values
You can override this by setting Delphi's global variables for
DecimalSeparator and CurrencyString. You will probably want to restore these
values after printing the report.
Below is a simple example:
var
lcSaveDecimalSeparator: Char;
lsCurrencyString: String;
begin
lcSaveDecimalSeparator := DecimalSeparator;
lsCurrencyString := CurrencyString;
DecimalSeparator := '.';
CurrencyString := '$';
try
Report.Print;
finally
DecimalSeparator := lcSaveDecimalSeparator;
CurrencyString := lsCurrencyString;
end;
end;
For the end-user solution you may to code an event-handler
for the Report.Template.OnLoadEnd event to setup the proper settings.
--
Tech Support mailto:support@digital-metaphors.com
Digital Metaphors http://www.digital-metaphors.com
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com