ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Data Namespace / Table Class / GetDefinition Method
Example

In This Topic
    GetDefinition Method (Table)
    In This Topic
    Gets the TableDefinition of this dataset. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Shadows Function GetDefinition() As TableDefinition
    public new TableDefinition GetDefinition()

    Return Value

    The TableDefinition of this dataset.
    Exceptions
    ExceptionDescription
    This dataset does not have a valid definition.
    A geodatabase-related exception has occurred.
    Remarks
    This routine will throw an exception if called on a joined table, since there is no underlying datastore for these temporary datasets. IsJoinedTable can be used to determine if this table represents a join.

    This routine will also throw an exception if called on a table obtained from a Mapping.ImageServiceLayer that is based on a ArcGIS.Core.Data.Raster.MosaicDataset. This is another temporary dataset that has no underlying datastore.

    Example
    Getting a Table Definition from a Layer
    {
      // GetDefinitionFromLayer - This code works even if the layer has a join to another table
      //Must be called within QueuedTask.Run()
      TableDefinition GetDefinitionFromLayer(FeatureLayer featureLayer)
      {
        // Get feature class from the layer
        FeatureClass featureClass = featureLayer.GetFeatureClass();
    
        // Determine if feature class is a join
        if (featureClass.IsJoinedTable())
        {
          // Get join from feature class
          Join join = featureClass.GetJoin();
    
          // Get origin table from join
          Table originTable = join.GetOriginTable();
    
          // Return feature class definition from the join's origin table
          return originTable.GetDefinition();
        }
        return featureClass.GetDefinition();
      }
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also