I am sure this is a silly question, but I can not seem to find it in the documentation, nor in any of hte examples.
I have a relatively simple DBAdvGrid. I am grouping on column1, with data sorted on column 2. Looks great and works as expected. I want to display totals for columns 3 and 4, but calling:
dbgJournal.GroupSum(3);
dbgJournal.GroupSum(4);
Doesn't seem to do what I want. When I have .MergeSummary set I get a left-aligned sum of column 4. When I don't, it displays in the rightmost column.
I am obviously missing something?
Screenshot: Dropbox - Screenshot 2023-04-14 06.00.11.png - Simplify your life
Use a Floating footer (grid.FloatingFooter.Visible = true) and set the column calculation via something like:
DBAdvGrid1.FloatingFooter.ColumnCalc[colindex] := acSUM
Thank you, as always, for your prompt and helpful response... This is closer to what I want, but not there yet.
I added the lines to add totals for the two columns, if I am understanding you correctly... Here is basically what I am doing:
dbgJournal.Sort(2);
dbgJournal.Group(1);
dbgJournal.GroupSum(3);
dbgJournal.GroupSum(4);
dbgJournal.FloatingFooter.ColumnCalc[3] := acSUM;
dbgJournal.FloatingFooter.ColumnCalc[4] := acSUM;
It is adding a floating footer at the bottom of my grid, but it is only totaling column 4?
See screenshot:
The GroupSum(4) is doing what I want (a summary line at the end of the group with the total of that field), but I want totals for BOTH fields. I like the grand-total floating footer and will keep that also.
What am I missing? Thanks in advance.
I could not reproduce this.
Code
begin
grid.Grouping.Summary := true;
grid.Group(1);
grid.GroupSum(2);
grid.GroupSum(3);
grid.FloatingFooter.ColumnCalc[2] := acSum;
grid.FloatingFooter.ColumnCalc[3] := acSum;
end;
Result
If a problem persists, please isolate and send sample source project with which we can reproduce this.