ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / SpatialMapSeries Class / SortField Property
Example

In This Topic
    SortField Property (SpatialMapSeries)
    In This Topic
    Gets or sets index layer's sort field.
    Syntax
    public string SortField {get; set;}
    Public Property SortField As String

    Property Value

    Type: String
    Remarks
    Optional. If not set, the default sorting field is the same as the page name field.
    Example
    Modify an existing map series
    {
      //Modify the currently active map series and changes its sort field and page number field.
      await QueuedTask.Run(() =>
      {
        SpatialMapSeries SMS = layout.MapSeries as SpatialMapSeries; //cast as spatial map series for additional members
        SMS.SortField = "State_Name";
        SMS.SortAscending = true;
        SMS.PageNumberField = "PageNum";
    
        //Overwrite the current map series with these new settings
        layout.SetMapSeries(SMS);
      });
    }
    Create a new spatial map series
    {
      // This example create a new spatial map series and then applies it to the active layout. This will automatically
      // overwrite an existing map series if one is already present.
      await QueuedTask.Run(() =>
      {
        //SpatialMapSeries constructor - required parameters
        BasicFeatureLayer indexLyr = map.FindLayers("Countries").FirstOrDefault() as BasicFeatureLayer;
        SpatialMapSeries SMS = MapSeries.CreateSpatialMapSeries(layout, mapFrame, indexLyr, "Name");
    
        //Set optional, non-default values
        SMS.CategoryField = "Continent";
        SMS.SortField = "Population";
        SMS.ExtentOptions = ExtentFitType.BestFit;
        SMS.MarginType = ArcGIS.Core.CIM.UnitType.PageUnits;
        SMS.MarginUnits = ArcGIS.Core.Geometry.LinearUnit.Centimeters;
        SMS.Margin = 1;
        SMS.ScaleRounding = 1000;
        layout.SetMapSeries(SMS);  //Overwrite existing map series.
      });
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also