ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / TableView Class / GetRowIndexAsync Method
The object id of the row.
Only search the active pages of the table for the object id.
Example Version

    GetRowIndexAsync Method (TableView)
    Gets the index of a row in the current ViewMode of the table.
    Syntax
    public Task<int> GetRowIndexAsync( 
       long objectId,
       bool activePageSearch
    )

    Parameters

    objectId
    The object id of the row.
    activePageSearch
    Only search the active pages of the table for the object id.

    Return Value

    The index of the row or -1 if the object id is not found.
    Example
    Translate between rowIndex and objectID
    //Get the active table view.
    var tableView = TableView.Active;
    if (tableView == null)
      return;
    
    // get the active rowindex
    int rowIndex = tableView.ActiveRowIndex;
    // increase
    int newIndex = rowIndex + 10;
    // get the objectID
    long newOID = await tableView.GetObjectIdAsync(newIndex);
    
    // get the rowIndex for a specific objectID
    //   2nd parameter indicates if the search only occurs for the pages loaded
    //   if pass false, then in the worst case, a full table scan will occur to 
    //    find the objectID.
    long OID = 100;
    var idx = await tableView.GetRowIndexAsync(OID, true);
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.1 or higher.
    See Also