Is it possible to make DBGrid summary grand total multiline?
====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*==== Nadya(Posted September 15, 2020) ----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*---- Hello!
My DBGrid contains columns with positive and negative values.
I need to calculate 3 summary grand total values for every column - positive, negative and common summary (positive + negative).
For this separate calculation I use Column.AuxValues[1], Column.AuxValues[2] and Column.AuxValues[3] in OnColumnSummary and OnColumnSummaryTotal events.
OnColumnSummary:
//positive if Column.Field.Value > 0 then Column.AuxValues[1] := Column.AuxValues[1] + Column.Field.Value; //negative if Column.Field.Value < 0 then Column.AuxValues[2] := Column.AuxValues[2] + Column.Field.Value; //total Column.AuxValues[3] := Column.AuxValues[1] + Column.AuxValues[2]; It works fine.
In OnColumnSummaryTotal event I would like to display this grand total values in 3 lines for every column:
Result := FormatFloat('##0.00', Column.AuxValues[1]) + #13#10 + FormatFloat('##0.00', Column.AuxValues[2]) + #13#10 + FormatFloat('##0.00', Column.AuxValues[3]); But it doesn't work, grand total row doesn't support text wrap and auto height. I can't place this values in 1 line because column will be too wide.
Is there any way to solve this problem or I should use additional components to display multi line grand total?
Thank you in advance for any advice!
====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*==== Sherzod(Posted September 15, 2020) ----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*---- Hello Nadya,
Try use '<br>' instead of #13#10
====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*==== Nadya(Posted September 15, 2020) ----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*---- Wonderful, that's exactly what is needed!!! Thank you VERY much!! :D
====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*==== Nadya(Posted September 15, 2020) ----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*---- And one more question about grand total summary - why OnColumnSummary and OnColumnSummaryTotal events doesn't work for text column?
I would like to place into grand total record (under text column "Name") this text: "Positive" + '<br>' + "Negative" + '<br>' + "Total"
But when I debug - this code doesn't work for my "Name" column
It's not allowed for text columns or maybe I've set some properties wrong?
Oh, if matters - my DBGrig has disabled Grouping
====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*==== Sherzod(Posted September 15, 2020) ----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*---- Is the issue resolved?
====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*==== Nadya (Posted September 15, 2020) ----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*---- For numeric columns - it's all right (after replacing #13#10 by '<br>').
But for text column - no.
I would like to place into grand total (under string column "Name") this text: "Positive" + '<br>' + "Negative" + '<br>' + "Total"
But it doesn't work and when I debug - debugger doesn't enter the code fragment for "Name" column (string datatype).
OnColumnSummary and OnColumnSummaryTotal event are not allowed for text columns? Or maybe I've set some properties wrong?
====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*==== Nadya(Posted September 15, 2020) ----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*---- I'd like to make my grand total look like this:
Name..........Sum1........Sum2 -----*-----*-----*-----*-----*-----*----- SomeText1....-100.........300 SomeText2.....200........-700 =====*=====*=====*=====*=====*=====*=====(grand total row) Negative.....-100........-700 Positive......200.........300 Total.........100........-400 =====*=====*=====*=====*=====*=====*=====(grand total row)
====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*==== Nadya(Posted September 15, 2020) ----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*---- Ooops! I've found the reason - for column "Name" property ShowSummary = False was set.
Problem solved. Thanks for help!!!
====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*==== Sherzod(Posted September 15, 2020) ----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*---- Yes.
----------------------------------------------
z@S7