ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Core.Data Namespace / Row Class / GetTable Method
Example

In This Topic
    GetTable Method (Row)
    In This Topic
    Gets the parent Table of this row. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public Table GetTable()
    Public Function GetTable() As Table

    Return Value

    The parent Table of this row.
    Exceptions
    ExceptionDescription
    This instance of Row/Feature does not have a parent Table/FeatureClass (e.g., if it is obtained via a QueryDef).
    A geodatabase-related exception has occurred.
    Example
    Evaluating a QueryDef on a single table
    {
      await QueuedTask.Run(() =>
      {
        using (Geodatabase geodatabase = new Geodatabase(new DatabaseConnectionFile(new Uri("path\\to\\sde\\file"))))
        {
          QueryDef adaCompilantParksQueryDef = new QueryDef
          {
            Tables = "Park",
            WhereClause = "ADACOMPLY = 'Yes'",
          };
    
          using (RowCursor rowCursor = geodatabase.Evaluate(adaCompilantParksQueryDef, false))
          {
            while (rowCursor.MoveNext())
            {
              using (Row row = rowCursor.Current)
              {
                Feature feature = row as Feature;
                Geometry shape = feature.GetShape();
    
                String type = Convert.ToString(row["ADACOMPLY"]); // will be "Yes" for each row.
    
                try
                {
                  Table table = row.GetTable(); // Will always throw exception.
                }
                catch (NotSupportedException exception)
                {
                  // Handle not supported exception.
                }
              }
            }
          }
        }
      });
    }
    Get domain string from a field
    {
      Task<string> GetDomainStringFromFieldAsync(Row row, Field field) => QueuedTask.Run(() =>
      {
        // Get the table and table definition from the Row
        using (Table table = row.GetTable())
        using (TableDefinition tableDefinition = table.GetDefinition())
        {
          // Get name of subtype field
          string subtypeFieldName = tableDefinition.GetSubtypeField();
    
          // Get subtype, if any
          Subtype subtype = null;
    
          if (subtypeFieldName.Length != 0)
          {
            // Get value of subtype field for this row
            object varSubtypeCode = row[subtypeFieldName];
            long subtypeCode = (long)varSubtypeCode;
    
            // Get subtype for this row
            subtype = tableDefinition.GetSubtypes().First(x => x.GetCode() == subtypeCode);
          }
    
          // Get the coded value domain for this field
          CodedValueDomain domain = field.GetDomain(subtype) as CodedValueDomain;
    
          // Return the text string for this field
          if (domain != null)
          {
            return domain.GetName(row[field.Name]);
          }
    
          return row[field.Name].ToString();
        }
      });
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also