ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Data.DDL Namespace / AttributeIndexDescription Class / AttributeIndexDescription Constructor / AttributeIndexDescription Constructor(String,TableDescription,IEnumerable<String>)
The name of the description.
The description object representing the ArcGIS.Core.Data.Table that will hold the attribute index.
The names of the ArcGIS.Core.Data.Fields present in the attribute index.
Example Version

AttributeIndexDescription Constructor(String,TableDescription,IEnumerable<String>)
Creates a description object of the attribute ArcGIS.Core.Data.Index.
Syntax

Parameters

indexName
The name of the description.
tableDescription
The description object representing the ArcGIS.Core.Data.Table that will hold the attribute index.
indexFieldNames
The names of the ArcGIS.Core.Data.Fields present in the attribute index.
Exceptions
ExceptionDescription
The list of field names is invalid.
Example
Creating a table with index from scratch
public void CreatingTableWithIndex(SchemaBuilder schemaBuilder)
{
  FieldDescription nameFieldDescription = FieldDescription.CreateStringField("Name", 50);
  FieldDescription addressFieldDescription = FieldDescription.CreateStringField("Address", 200);

  // Creating a feature class, 'Buildings' with two fields
  TableDescription tableDescription = new TableDescription("Buildings", new List<FieldDescription>() { nameFieldDescription, addressFieldDescription });

  // Enqueue DDL operation to create a table
  TableToken tableToken = schemaBuilder.Create(tableDescription);

  // Creating an attribute index named as 'Idx'
  AttributeIndexDescription attributeIndexDescription = new AttributeIndexDescription("Idx", new TableDescription(tableToken),
    new List<string> { nameFieldDescription.Name, addressFieldDescription.Name });

  // Enqueue DDL operation to create an attribute index
  schemaBuilder.Create(attributeIndexDescription);

  // Execute build indexes operation
  bool isBuildSuccess = schemaBuilder.Build();
}
Adding indexes in pre-existing dataset
public void AddingIndexes(SchemaBuilder schemaBuilder, FeatureClassDefinition featureClassDefinition)
{
  // Field names to add in the attribute index
  string fieldName = featureClassDefinition.GetFields().First(f => f.AliasName.Contains("Name")).Name;
  string fieldAddress = featureClassDefinition.GetFields().First(f => f.AliasName.Contains("Address")).Name;

  // Creating an attribute index with index name 'Idx' and two participating fields' name
  AttributeIndexDescription attributeIndexDescription = new AttributeIndexDescription("Idx", new TableDescription(featureClassDefinition), new List<string> { fieldName, fieldAddress });

  // Enqueue DDL operation for an attribute index creation 
  schemaBuilder.Create(attributeIndexDescription);

  // Creating the spatial index 
  SpatialIndexDescription spatialIndexDescription = new SpatialIndexDescription(new FeatureClassDescription(featureClassDefinition));

  // Enqueue DDL operation for the spatial index creation
  schemaBuilder.Create(spatialIndexDescription);

  // Execute build indexes operation
  bool isBuildSuccess = schemaBuilder.Build();

  if (!isBuildSuccess)
  {
    IReadOnlyList<string> errors = schemaBuilder.ErrorMessages;
    // Iterate and handle errors 
  }
}
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3.1 or higher.
See Also