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

TppDBCalc - dcSum - data type?

edited June 2004 in General
I am using a ppDBCalc to accumulate monetary values
from a BCD table field.
DBCalcType = dcSum

Is the ppDBCalc "smart enough" to use Currency data
type or does it use a float data type to accumulate the
totals? In other words, do I need to be concerned about
rounding problems inherent with floats.

To my knowledge, the reports have always been accurate to the cent
so far so perhaps I don't need to be worried

Jon
--
Jon Lloyd Duerdoth
Welsh Dragon Computing
http://www.welshdragoncomputing.ca
Visit All Saints' Kingsway Anglican Church
http://www.allsaintskingsway.ca

Comments

  • edited June 2004
    Hi Jon,


    Unfortunately not. By default the ftBCD type is set to the dtDouble data
    type in ReportBuilder since BCD values do not always imply a currency value.
    You will need to use a TppVariable to calculate the sum and set its Data
    Type to Currency to get the correct formatting. We are currently
    researching adding a new data type for BCD fields to ReportBuilder.

    Note: A customer of ours noticed a bug in the way we were rounding our
    currency values which was fixed in a recent patch. If you would like this
    patch, please send an email to support@digital-metaphors.com and we'll send
    it right out to you.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2004
    Nico,

    Just a follow-up. If I use a TppVariable, I see that oncalc
    passes Value as variant. I'm not overly familiar with rules
    regarding variant.

    Using:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    procedure TrptContribs.ppVarTotalContribsCalc(Sender: TObject;
    var Value: Variant);
    begin
    value := value + dbitContRecsContributionAmount.AsCurrency;
    end;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Will onCalculate process a BCD field asCurrency without
    any float conversions to mess up everything (i.e. if I've set
    the TppVariable.DataType = dtCurrency)?

    Jon

  • edited June 2004
    Hi Jon,

    Though I have not tried it this way, ReportBuilder should pick up on the
    value type of the variant if you format it this way. You could also (using
    the listbox in the upper left corner when you create a TppVariable) manually
    assign the type of the TppVariable when you create it, or as you said below
    set the TppVariable.DataType to dtCurrency. If you do this, there will be
    no need to use the AsCurrency method.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2004
    Nico,
    Is the round off patch rolled into V7.04?

    Jon


  • edited June 2004
    Hi Jon,

    Yes it is.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2004
    Thanks,
    Jon
This discussion has been closed.