I would like to keep a running total of a column (accumulate by line).
Example : today I know how to have the results in black, how can I have the red values.
Thanks for your help…
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Hi Leonard,
To accomplish this task, handle the 'COLIS DIS' field's OnCalculateCustomSummary event to calculate custom summary values for this field. The following code snippet represents the modified version of the 'Payment Amount' field's OnCalculateCustomSummary event handler from the OrderReportsDemo shipped with the ExpressPivotGrid Suite. This event handler calculates rolling totals accumulated by rows. To display custom summary values, set the 'Payment Amount' field's SummaryType property to stCustom.
function VarToDouble(const AValue: Variant): Double; begin Result := 0; if not VarIsNull(AValue) then Result := AValue; end; procedure TfrmOrderReport.pgfPaymentAmountCalculateCustomSummary( 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;
The following code snippet represents the 'Payment Amount' field's OnGetDisplayText event handler. This event handler displays a cell's rolling total and summary separated by a slash ('/').
procedure TfrmOrderReport.pgfPaymentAmountGetDisplayText( Sender: TcxPivotGridField; ACell: TcxPivotGridDataCellViewInfo; var AText: String); begin inherited; AText := FloatToStr(VarToDouble(ACell.CellSummary.Custom)) + ' / ' + FloatToStr(VarToDouble(ACell.CellSummary.Sum)); end;
Please let us know whether this solution makes sense.
Thanks,
Alex.
This works.
Thanks for All.
Leonard