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
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
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
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.