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

Rounding

edited December 2008 in General
I'm using RB 10.09 and I have a currency field in a database table with the
value 0.065

If I display the field with the format: $#,0.00;-$#,0.00 the field is
displayed as ?0.07

However if I display the field with the format #,0.00;-#,0.00 the field is
displayed as 0.06

Why is there this discrepancy?

Best regards,


Simon

Comments

  • edited December 2008
    Hi Simon,

    All formatting is taken care of in the ppDisplayFormat.pas file. If you
    take a look at the TppDisplayFormat.Format routine, you can see that if a
    "$" is detected in the display format, the FloatToStrF routine is used to
    get the value. Otherwise the FormatFloat routine is used.

    It is possible to completely replace this class with your own using the
    global variable gcDisplayFormat located in the ppUtils.pas file.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2008
    Hi Nico,

    Thanks for that. Sorted it by including a custom version of the
    ppDisplayFormat.pas file my application source folder.

    Best regards,

    Simon


This discussion has been closed.