Problems with calculation of Grant Totals in FR

Hi !
I have some problems with calculation a grand total in my report.
My report consist from two subreports which have own totals.
I want to have grand total by these subreports on the main page.
I declared a new variable with the next code:
SUM([Cost], PersonalDataBand)+SUM([Cost], StructDataBand) and after I assigned this value to some Memo.
But this memo always show me zero.
Can anyone help me with it ?

I use FastReport v2.5 with Delphi 7.

Thanks,
Roman

Comments

  • edited 6:50PM
    I am not sure but it seems to me that when you use a variable the result is affected at the begining of the report execution so before all the calculations.

    So the best way is to use the same code, but in the 'OnBeforePrint' of the band of memo where is you result.
    Be sure that this memo is designed AFTER the calculations it needs, if not use the 'twopass' report option.

    There are some reports like this in the demo.
  • gordkgordk St.Catherines On. Canada.
    edited 6:50PM
    Hi Roman
    Understand that fr processes a designpage from top down, l to r,
    so you cannot modify an object which has already been processed, from code which is processed after, unless you make a report 2 pass, and gather values in firstpass and store in array or a variable and use if finalpass then blocks of code to
    to substitute values stored in array to vars used for display.
    take a close look at the main demo group totals in header report. you can apply this concept to any combination.
    regards ;)

Leave a Comment