Group Footer Sum

Hello,

I have run into this issue more than once so I'm hoping to see if there is a different way I should be doing this.

I have a FastReport with a group. In the group footer I have put a sum memo box [SUM(<qry."AMOUNT">,BaseMasterData)]. This sum doesn't specify that I want the sum to be per group, but it is giving the correct summed value so I guess FR knows to only sum per group if it's in the group footer.

My problem is that I can't seem to sum per group in code. I currently have an event GroupFooterOnBeforePrint in which I am trying to do math with that group sum. When running the program, I stop in that event and evaluate: SUM(<qry."AMOUNT">,BaseMasterData) but it returns 0. FYI, I am looking to get the sum per group, not the whole report.

I have noticed on some occasions that this situation will work if I have a memo box in the group footer doing the same equation, but in this case that isn't working.


Please help me to understand how to sum values per group in code.

Thank you,
Bridget

Comments

  • edited 7:56AM
    So I have sort of figured out my problem. I changed the code for the group sum:

    Incorrect: SUM(<qry."AMOUNT">,BaseMasterData)

    Correct: <SUM(<qry."AMOUNT">,BaseMasterData)>

    The funny thing is that, still, this only works if I have a memo box in the group footer doing the same equation. If I remove the memo box that sums <qry."AMOUNT">, and evalute <SUM(<qry."AMOUNT">,BaseMasterData)> in the code, the value is Null. If I put the memo box back into the group footer, the sum is correct. Why is this working this way?

    Bridget
  • edited 7:56AM
    I always noticed that too. You can only use SUM within the footer or header. You cannot get any SUM outside of a footer or header.

    It would be nice if that can be done outside of a group, but I think that since SUM gets the values from the DATA there is more than 1 value returning there and getting the sum of it without the group it cannot be done.

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.