Hello,
-
I want to do different calculations depending on the
footer
vsGroupFooter
type of summary but within the event method, I don't know how to tell the difference. I can play with the tags but I'd prefer to be able to identify the type of summary. -
More problematic: I have used this article to hide one of the groupfooters. This is working correctly (at the price of a bigger complexity) but I am not able to do custom calculations.
As a reminder, on that article, we create a subclass of TcxDBBandedTableView (and a few other classes) and do something like this in the OnCreate event of the form:
DelphiAView := GRoyalties.CreateView(TcxMyGridDBBandedTableView) as TcxMyGridDBBandedTableView;
AView.AssignPattern(vRoyalties);
GRoyaltiesLevel2.GridView := AView;
My custom calculation code is this:
Delphiprocedure TFAgreement.vRoyaltiesDataControllerSummaryFooterSummaryItemsSummary(
ASender: TcxDataSummaryItems; Arguments: TcxSummaryEventArguments;
var OutArguments: TcxSummaryEventOutArguments);
var
AValue,BaseRedev: Variant;
IsSelected: Variant;
AItem: TcxGridTableSummaryItem;
avirer:String;
begin
AItem := TcxGridTableSummaryItem(Arguments.SummaryItem);
if (AItem.Tag > 0) and (AItem.Position = spFooter) then begin
avirer:=TcxGridDBBandedColumn(aitem.Column).DataBinding.FieldName;
if avirer='s' then
write;
AValue := TcxGridDBBandedTableView(GRoyalties.FocusedView).DataController.Values[ Arguments.RecordIndex, AItem.Column.Index ];
BaseRedev := TcxGridDBBandedTableView(GRoyalties.FocusedView).DataController.Values[ Arguments.RecordIndex, TcxGridDBBandedTableView(GRoyalties.FocusedView).GetColumnByFieldName('baseredevance').Index ];
if not VarIsNull(AValue) and not VarIsNull(BaseRedev) then
OutArguments.Value:=AValue*BaseRedev/100
else
OutArguments.Value:=0;
OutArguments.value:=18;
end
end;
The AItem.tag for this particular GroupFooter summary is 2
The avirer
variable is here for debugging purposes and always contains "idad" which is a field that is not used in any summary. So my guess is that the Arguments.SummaryItem points to something wrong.
As you can see, I am assigning the value 18
to OutArguments.value but I never see this value in any Summary although the program correctly stops on the breakpoint that I set on the line if avirer='s' then
.
I hope you can help me understand what is going on.
Thanks in advance.