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 10:19AM
    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 10:19AM
    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

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.