Count visible rows in table after filterRows() is applied?

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
3 posts • Page 1 of 1
RJM1987
Posts:11
Joined: Mon Feb 24, 2020 5:06 am

Count visible rows in table after filterRows() is applied?

Post by RJM1987 »

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.

kilianvp
Posts:443
Joined: Fri Jan 16, 2015 10:29 am

Re: Count visible rows in table after filterRows() is applied?

Post by kilianvp »

There is no function to count the visible lines. You have to write a function yourself.

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?

Post by RJM1987 »

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.

3 posts • Page 1 of 1