Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

ThousandSeparator and OnFormat

edited September 2006 in General
Hi:

I'm using RB6.03 Pro (Delphi 5) and need to print a currency amount WITHOUT
ANY thousands separator (to keep the width as small as possible). I tried
futzing with the ThousandSeparator and setting it to null and that didn't
work so I figured the easiest thing to do would be to do the formatting
myself in an OnFormat event for the DBText field. I'm making the conversion
and setting the Text parameter to the proper string (I verified this by
debugging/popping up a message with the string) so I know the event is
firing and I'm formatting the Text parameter properly. HOWEVER, the report
STILL prints the amount with commas as thousands separator.

Is there something else I need to do to get the results of my formatting
passed to RBuilder for printing?

Any info would be appreciated.

=NLK=

Comments

  • edited September 2006
    Hi NLK,

    In my testing with RB 10.04 and Delphi 7, adding the following code to the
    OnFormat event worked correctly, removing the thousand separator from the
    currency value.

    procedure TForm1.ppDBText1Format(Sender: TObject; DisplayFormat: String;
    DataType: TppDataType; Value: Variant; var Text: String);
    begin
    Text := FormatFloat('$#0.0;-$#0.0', Value);
    end;

    If this does not work in your case, this may have been a bug that was fixed
    for a later version of ReportBuilder. I would suggest downloading a trial
    edition of RB 7.04 for Delphi 5 (this was the last version that supported
    Delphi 5) and test with that.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2006
    Nico:

    While your format string is definitely a more elegant solution, I had no
    problem actually formatting without the Thousands Separator. Text came out
    fine. It was getting what was in Text to print in the field area that was
    the problem.

    So I will download RB 7.04 as you suggest and see if the problem is a bug in
    my version.

    Thanks.

    =NLK=

This discussion has been closed.