meaning of values returned by GetIntersectedFilteredInRows

Posted by: rgreene on 8 September 2017, 2:27 pm EST

  • Posted 8 September 2017, 2:27 pm EST

    What exactly are the int values that <FONT face=Helv size=2><FONT face=Helv size=2>GetIntersectedFilteredInRows returns? V<FONT face=Helv size=2><FONT face=Helv size=2>iew row indeces, model row indeces, data source row indeces, or something else?</FONT></FONT></FONT></FONT>

    <FONT face=Helv>They appear to change depending on how columns are sorted, but then converting them via <FONT size=2>GetModelRowFromViewRow still leads to inconsistent results.

  • Replied 8 September 2017, 2:27 pm EST

    P.S.  If I also call <FONT size=2>GetFilteredOutRowList, I find that sometimes the row numbers that it returns are also contained in the returned values from <FONT face=Helv>GetIntersectedFilteredInRows.  How can that be?</FONT></FONT>
  • Replied 8 September 2017, 2:27 pm EST


    The indexes returned by GetIntersectedFilteredInRows are model row indexes.  You can convert them to view row indexes with GetViewRowFromModelRow if you need to pass the row index into a SheetView method, or use them directly to pass into one of the sheet models (in SheetView.Models), except for the Selection model, which always uses view indexes.

  • Replied 8 September 2017, 2:27 pm EST

    OK, thanks.  But if they are model row indexes, why are the values returned by GetIntersectedFilteredInRows different before and after a sort, which I would only expect to affect the view row indexes?  For example, a first call to GetIntersectedFilteredInRows returns 2,4,5,3.  Then I click the sort icon on a column, so that I see the same 4 rows in a slightly different order, call GetIntersectedFilteredInRows again, and get 2,3,1,0 this time. 

    Also, how is it that a call to GetIntersectedFilteredInRows immediately followed by a call to GetFilteredOutRowList returns sets of indexes, some of which are contained in both lists?  In other words, how can a row be both filtered in and filtered out?

    So far, the only way I've been able to programmatically determine which rows are filtered in or out is by using <FONT size=2>IsRowFilteredOut like this:</FONT>

    <FONT size=2><FONT size=2>

    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>for</FONT></FONT><FONT size=2> (</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>int</FONT></FONT><FONT size=2> i = 0; i < activeSheet.RowCount; i++)</FONT>

    <FONT size=2>{

    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>    if</FONT></FONT><FONT size=2> (activeSheet.RowFilter.IsRowFilteredOut(activeSheet.GetViewRowFromModelRow(i)))

    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>     ...</FONT></FONT>

    which is also counterintuitive, since I would have thought 'i' was already indexing through view rows rather than model rows.  Perhaps you can help clear up my confusion.

  • Replied 8 September 2017, 2:27 pm EST


    I'm sorry, I was mistaken; it is returning the view row indexes.  When I translate the row indexes returned by GetIntersectedFilteredInRows using GetModelRowFromViewRow, it returns a consistent list for a given set of filtered rows, regardless of the sort state.

    It is GetFilteredOutRowList that returns model rows.  When I put the model row index for each row in a column, GetFilteredOutRowList returns a list missing the same model row indexes (in a different order, but the same indexes missing) regardless of the sort state.

    Sorry for the confusion!

  • Replied 8 September 2017, 2:27 pm EST

    OK, thanks for the clarification.  Now I can see that GetIntersectedFilteredInRows is indeed returning view rows, apparently sorted in order of their corresponding model row. 
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels