SUM Aggregate Error?

Hi!
in fast report 3.07:
the result of my sum expresion memo is: 1.50015000E019
where is the problem? this is not a corect Aggregation!
I cheked Main Demo Exsample too....

Comments

  • edited 8:07AM
    If you are adding up any numbers that have fractional values then you'll always have a chance of having imprecise values.

    Said another way a computer has no way to store 1/3. At some point it does it's best but you are left with an ugly number.

    You didn't say what type of data you are SUMing: floats, BCD or Currency. That can make a difference as well. And sometimes you have to round your results before you display them. 1.50015000E019 rounded to two decimal places will show 1.50.

    Regards,

    Django
  • edited 8:07AM
    Thanks djangman for your kindness!
    My data in bank is String format numbers(numbers saved in String Fields)
    but in the report I choosed %2.2n numerical display Formatting for it
    but the respons is not Correct and Rounded....
    please guide me step by step...
    with best wishes & regards
    majid
  • gordkgordk St.Catherines On. Canada.
    edited 8:07AM
    Hi
    this is your problem
    My data in bank is String format numbers(numbers saved in String Fields)
    just as in delphi
    you can't use numerical functions on string values.
    if you looked closer at the demos which work fine you would see that the underlying datafields are of currency type
    for example the nestedgroup group report
    memo in footer contains
    [Sum(<Sales."Qty">*<Sales."List Price">)]
    since the fields are numeric the aggregate works fine.
    if the fields were string fields
    you would need to wrap each field with the function required to make them numeric

    StrToFloat()

    so
    [Sum([StrToFloat(<Sales."Qty">)]*[StrToFloat(<Sales."List Price">)])]
    would be correct.
    ;)
  • edited 8:07AM
    Hi! thanks for your consideration...
    you are right! this is a my programical problem....
    But this problem works properly in fastreport 2.43!!!! and responses are corect!!!!
    what is the difrent between 2.43 and 3.07 fastreport versions?
  • gordkgordk St.Catherines On. Canada.
    edited 8:07AM
    The whole class architeture has changed, read the whats new file, then the programmers manual and the user manual, and look at the demos.
    ;)

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.