AdvStringGrid - filtering und row counting

how can i get the number of filtered rows?
Best regards

Please check with grid.NumHiddenRows:integer;

Thanks for the answer. It works fine in AdvStringGrid.
Why i coudn't find DBAdvGrid.NumHiddenRows?
Best regards

I have no idea why you can't find it, it is there. TDBAdvGrid descends from TAdvStringGrid so automatically inherits this property.

OK, the property is available at designtime, but the value is ever 0, with filter active or not.
During debugging the IDE don't known NumHiddenRows, other properties (like RowCount or FixedRows) are available.
Best regards,

I have no idea what you see, but this is not a design time property and the property is a public property and is available at runtime.

thanks for the reply.
There was a logical problem in my code. Sorry
Best regards

How can I know the number of rows in the advstringgrid after using the filter?

For example, Total records: 20 out of 100, where 20 is from the filter and 100 is the total of the data loaded.

NumHiddenRows is returning 0 (zero)

Thank you

grid.RowCount returns nr. of visible rows
grid.TotalRowCount returns total number of rows

Good morning, how are you?

I tested both sgMonGrid.TotalRowCount and sgMonGrid.RowCount, and they returned the same number of rows.

procedure TfConsultaSGI.sgMonGridFilterDone(Sender: TObject);
totalLinhas, linhasFiltradas, i: Integer;
// Contar a quantidade total de linhas
{totalLinhas := sgMonGrid.RowCount - 1; // Exclui a linha do cabeçalho

// Contar a quantidade de linhas filtradas
linhasFiltradas := 0;

for i := 1 to sgMonGrid.RowCount - 1 do
if not sgMonGrid.IsHiddenRow(i) then
// Exibir os resultados
ShowMessage('Total de linhas: ' + IntToStr(sgMonGrid.TotalRowCount) +
', Linhas filtradas: ' + IntToStr(sgMonGrid.RowCount));

What is the setting for grid.FilterType?
If this is ftSuppressed, you might need to use grid.NumSuppressedRows to get the number of suppressed rows by filtering.

Now I followed your tip and it worked, thank you very much.