Skip to main content
Table of Contents

TTMSFNCCustomDataGrid.ColumnSum Method

Returns the sum of the numeric values in a column.

API unit family: TMSFNCDataGrid Declaring type: TTMSFNCCustomDataGrid

Syntax

FMX.TMSFNCDataGrid.hppPascalC++
function ColumnSum(AColumn: Integer; AFromRow: Integer = -1; AToRow: Integer = -1): Double;
double __fastcall ColumnSum(int AColumn, int AFromRow = 0xffffffff, int AToRow = 0xffffffff);

Remarks

When either bound is -1, all rows between the fixed top and fixed bottom rows are used. Only base cells in default rows (not group, summary or node rows) are included, and hidden (for example filtered) rows are skipped unless Options.Calculations.IncludeHiddenRows is True. To show a result in the grid, use ColumnCalculations instead.

Parameters

Name Description
AColumn Zero-based column index.
AFromRow First row to include, or -1 (default) for the whole data range.
AToRow Last row to include, or -1 (default) for the whole data range.

Returns

The sum; cells that cannot be read as numbers are skipped.

Examples

Pascal
Total := Grid.ColumnSum(3);