Decimals / Displayformat question
Hello all,
We've got a report with a DBText-component assigned to a (currency) field of
a TClientDataset (dbExpress/Interbase)
The problem is with printing decimals.
When, for example, a value of 1995.95 must be printed, the report prints
'1995.95' just fine.
But, when a value of 1995.00 must be printed, the report prints only '1995',
thus without the decimals '.00'
How is this possible? How can i force reportbuilder to print the '.00' also?
I've tried to set the Displayformat property to multiple formats, but this
doesn't work.
Thanks in advance,
--
Marcel van Bloppoel
Software Engineer
Vendit B.V.
http://www.vendit.nl/
We've got a report with a DBText-component assigned to a (currency) field of
a TClientDataset (dbExpress/Interbase)
The problem is with printing decimals.
When, for example, a value of 1995.95 must be printed, the report prints
'1995.95' just fine.
But, when a value of 1995.00 must be printed, the report prints only '1995',
thus without the decimals '.00'
How is this possible? How can i force reportbuilder to print the '.00' also?
I've tried to set the Displayformat property to multiple formats, but this
doesn't work.
Thanks in advance,
--
Marcel van Bloppoel
Software Engineer
Vendit B.V.
http://www.vendit.nl/
This discussion has been closed.
Comments
in this case is one we have listed as #,0.00;(#,0.00)
IF that isn't what you want, then you have full control over the display
formats. Here is an example of replacing them and adding new ones.
http://www.digital-metaphors.com/tips/ReplaceDisplayFormats.zip
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
When using the format '#,0.00;(#,0.00), this is wat IS printed: '1,. ;(,. )'
Huh? It's printing only the first digit of 1995.00, and it prints the
formatstring itself.
I'm lost...
--
Marcel van Bloppoel
Software Engineer
Vendit B.V.
http://www.vendit.nl/
Modify your library path from RBuilder\Lib to RBuilder\Source. Open
ppDisplayFormat.pas and put a break point at the top of the method. Then
create a simple test report that contains only the datafield that you are
trying to format. Run the test report and trace the format logic in the
debugger. The format logic internally calls Delphi's formatting functions,
depending upon the datatype of the datafield. FloatToStrF is called for
numeric fields, FormatMaskText is called for strings, FormatDataTime is
called for dates, etc.
--
Nard Moseley
Digital Metaphors
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
I did what you said and while debugging i discovered that in the function
'ppConvertFieldType' checks
the 'aFieldType'.
The case statement checks on 'ftFloat, ftBCD', but the datafield of the
clientdataset is a 'ftFMTBcd' fieldtype.
In that case its handled like a dtString variable, instead of a dtDouble
variable.
I changed the line...
function ppConvertFieldType(aFieldType: TFieldType): TppDataType;
case aFieldType of
...
ftFloat, ftBCD: Result := dtDouble;
...
end;
in
function ppConvertFieldType(aFieldType: TFieldType): TppDataType;
case aFieldType of
...
ftFloat, ftBCD, ftFMTBcd: Result := dtDouble; // Added ftFMTBcd (!)
... --------
end;
And now it Works like it should!
Greetings,
--
Marcel van Bloppoel
Software Engineer
Vendit B.V.
http://www.vendit.nl/
this field data type. Upgrading to the latest version would have corrected
the problem.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com