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

Display Format dbText Field

edited September 2012 in General
I am presenting in a sub report, currency data derived from some old BDE
sql datasets. We have a mixture of positive and negative values.

I want to display the negatives without - or (). In RAP ongettext or
elsewhere can I set the display format to "$#,0;$#,0" or "#,0;#,0".

Finally if this can be done, can you assist with sample code to use
"$#,0;$#,0" for the first record in a group and thereafter "#,0;#,0"

Thanks

Mike

Comments

  • edited September 2012
    Hi Mike,

    You can use the DisplayFormat property to define your custom display
    formats. If however you include a currency sign inside your display
    format, RB will use the FloatToStrF routine with the format type being
    ffCurrency so parentheses will be used regardless. You can override
    this behavior by replacing the display format class
    (ppDisplayFormat.pas) with your own altered version. It should be
    fairly simple, you can see at the top of the TppDisplayFormat.Format
    routine where it checks for the currency symbol ($). See the following
    article.

    http://www.digital-metaphors.com:8080/Design/Formatting/Currency_Formatting

    You can change the display format of a text object in RAP using the
    OnPrint event or the Band.BeforePrint event. Simply set its
    DisplayFormat property.

    To change the Displayformat after the first record of a group, you could
    create a global boolean var (flag) that sets to True after a group
    breaks (Group.AfterGroupBreak) where you would also set the display
    format for certain text objects. Then inside the DetailBand.AfterPrint,
    you can reset the flag and change the displayformat back.

    Best Regards,

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

    display format of a text object in RAP using the

    Was what I was looking for :)

    Mike

This discussion has been closed.