Search code examples
delphidelphi-7reportbuilder

Negative values in Reportbuilder's TDBText's Display Format


Using report Builder 7.x

I am trying to format a TDBText to display postive and negative dollar amounts in a 12 character field, left padded with zeros

example

000000001720 or -00000001720

I right click on my TDBText and choose display format and edit it to say:

000000000000;-00000000000

however, this does not work.

Actually the left side (Positive) works, but the right side (negative) does not. I get characters trucated off the end. I lose the cents. The whole part gets rounded up.

actual values are:

-1671.56
-685254
193.15
4974.15

displayed values are:

-00000001672
-00000005853
000000000193
000000004974

displayed values should be:

-00000167156
-00000585254
000000019315
000000497415

what am i doing wrong?


Solution

  • I replaced the TDBText with a Variable component instead and added my own custom code. Works like a charm.