Home General

Replacing some letters with displayformat possible?

edited April 2011 in General
Hello,

a customer would like to "hide" the last 3 letters of a string-DBText or
better to say to replace them by XXX. It's an account number, which can
contain letters too and he wants to hide the last 3 letter.

I've tried to get it done by using the displayformat, but wasn't able to
figure out a proper format. Is it possible in general? If yes: what would be
the proper format?

Kind regards,
Mark

Comments

  • edited April 2011
    Hi Mark,

    I do not believe this is possible using the DisplayFormat of the
    control. See the ppDisplayFormat.pas file for exactly how ReportBuilder
    applies the DisplayFormat info to the text of a report object.

    I recommend intercepting the text of the DBText before it is printed and
    altering it there. (OnPrint, Band.BeforePrint, etc.).


    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2011
    RB DisplayFormat internally calls Delphi's FormatFloat. I looked in the
    Delphi help and do not see any format specifiers to replace characters.

    One option is to implement custom formatting. 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 of ppDisplayFormat.pas.


    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited May 2011
    Ok Nico and Nard,

    thank you both for your help.

    Kind regards,
    Mark

This discussion has been closed.