Share via


SortProperty.Direction Property

SortProperty.Direction Property

Determines the direction (Ascending or Descending) of sorting for the property specified by the PropertyName property.


Public Property Direction As SortDirection


[C#]

public property SortDirection Direction;

Remarks

  • By default the sort direction is set to Ascending.

Example

[Visual Basic]

    Dim findServiceSoap As FindServiceSoap = New FindServiceSoap
    findServiceSoap.Credentials = _
        New NetworkCredential(myMapPointUserId, mySecurePassword)

    Dim strs As String() = New String() {"Manager"}
    Dim sortPropertys As SortProperty() = New SortProperty() {New SortProperty}
    sortPropertys(0).PropertyName = "Manager"
    sortPropertys(0).Direction = SortDirection.Descending
    Dim findNearbySpecification As FindNearbySpecification = New FindNearbySpecification
    findNearbySpecification.DataSourceName = "MapPoint.FourthCoffeeSample"
    findNearbySpecification.Distance = 1.0
    findNearbySpecification.LatLong = New LatLong
    findNearbySpecification.LatLong.Latitude = 47.6
    findNearbySpecification.LatLong.Longitude = -122.33
    findNearbySpecification.Filter = New FindFilter
    findNearbySpecification.Filter.EntityTypeName = "FourthCoffeeShops"
    findNearbySpecification.Filter.PropertyNames = strs
    findNearbySpecification.Filter.SortProperties = sortPropertys
    Dim findResults As FindResults = findServiceSoap.FindNearby(findNearbySpecification)



[C#]

   FindServiceSoap findService = new FindServiceSoap();
   findService.Credentials = 
    new System.Net.NetworkCredential(myMapPointUserId, mySecurePassword);

   string[] returnProperties = new string[1];
   returnProperties[0] = "Manager";

   //Specify what properties to be used to sort the found results
   SortProperty[] sortproperties = new SortProperty[1];
   sortproperties[0] = new SortProperty();
   //Assign the property name to be sorted on
   sortproperties[0].PropertyName = "Manager";
   //Specify the sort direction: Ascending or Descending
   sortproperties[0].Direction = SortDirection.Descending;


   FindNearbySpecification findNearbySpec  = new FindNearbySpecification();
   findNearbySpec.DataSourceName = "MapPoint.FourthCoffeeSample";
   findNearbySpec.Distance = 1;
   findNearbySpec.LatLong = new LatLong();
   findNearbySpec.LatLong.Latitude = 47.6;
   findNearbySpec.LatLong.Longitude = -122.33;
   findNearbySpec.Filter = new FindFilter();
   findNearbySpec.Filter.EntityTypeName = "FourthCoffeeShops";
   findNearbySpec.Filter.PropertyNames = returnProperties;

   //Assign the sort property list to the 
   //find nearby specification filter object
   findNearbySpec.Filter.SortProperties = sortproperties;

   FindResults foundResults;
   foundResults = findService.FindNearby(findNearbySpec);


See Also

  SortDirection Enumeration   |   FindFilter Class   |   SortProperty Class