2011-07-15 9 views

答えて

0

フィールドのRunningTotalプロパティをtrueに設定する必要があります。

+0

OK、私このプロパティを利用できるより前のバージョンを持っている場合は、この関数を手動で実装する必要があります。 –

1

あなたは、フィールドのOnCalculateCustomSummaryイベントにこのコードを追加する必要があります。

から抽出
procedure TForm1.cxDBPivotGrid1Field2GetDisplayText(Sender: TcxPivotGridField; ACell: TcxPivotGridDataCellViewInfo; var AText: string); 
begin 
    inherited; 
    AText := VarToStr(ACell.CellSummary.Custom) 
end; 

フィールドのOnGetDisplayTextイベントで
procedure TMyForm.cxDBPivotGrid1Field2CalculateCustomSummary(Sender: TcxPivotGridField; ASummary: TcxPivotGridCrossCellSummary); 
var 
    AColumn: TcxPivotGridGroupItem; 
    APrevCrossCell: TcxPivotGridCrossCell; 
    APrevCrossCellSummary: TcxPivotGridCrossCellSummary; 
begin 
    inherited; 
    AColumn := ASummary.Owner.Column; 
    if (AColumn.Level = -1) then 
    // column grand totals 
    ASummary.Custom := ASummary.Sum 
    else begin 
    // all cells, except for column grand totals 
    // getting a custom summary calculated for the previous grouping value 
    if AColumn.PrevSibling <> nil then begin 
     APrevCrossCell  := AColumn.PrevSibling.GetCellByCrossItem(ASummary.Owner.Row); 
     APrevCrossCellSummary := APrevCrossCell.SummaryCells[Sender.SummaryIndex]; 
     ASummary.Custom  := VarToDouble(APrevCrossCellSummary.Custom) + VarToDouble(ASummary.Sum); 
    end 
    else 
     ASummary.Custom  := ASummary.Sum; 
    end; 
end; 

そしてこの http://www.devexpress.com/Support/Center/p/Q90021.aspx

関連する問題