Once filterRows() is applied to a table, is there a function that will return or count the visible (aka "unfiltered") rows that remain?
I'm surprised that with all of the table functions mentioned in the documentation that such a simple function isn't available - or have I missed something?
Note that lineRangeVisible() by itself is not appropriate as it only returns the indices of the upper and lower visible rows, so if any rows between that range are filtered out the difference between these two values won't give a correct count of the visible rows.
Count visible rows in table after filterRows() is applied?
- RJM1987
- Posts:11
- Joined: Mon Feb 24, 2020 5:06 am
Count visible rows in table after filterRows() is applied?
- kilianvp
- Posts:443
- Joined: Fri Jan 16, 2015 10:29 am
Re: Count visible rows in table after filterRows() is applied?
There is no function to count the visible lines. You have to write a function yourself.
Something like this:
Something like this:
Code: Select all
int iNumberVisibleLines = 0;
for (int i = 0; i < TABLE.lineCount; i++)
{
if (!TABLE.isRowHidden(i))
{
iNumberVisibleLines = iNumberVisibleLines + 1;
}
}- RJM1987
- Posts:11
- Joined: Mon Feb 24, 2020 5:06 am
Re: Count visible rows in table after filterRows() is applied?
Thanks for the clarification, I was hoping to avoid having to use a for-loop when filtering the table (as the filterRows() function already does this very efficiently, especially when the table has thousands of rows of data) but if that's the only option I'll give it a go. Cheers.