This document is archived and information here might be outdated.  Recommended version.


INAClassDefinitionEdit.CandidateFieldNames Property (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (NetworkAnalyst)  

INAClassDefinitionEdit.CandidateFieldNames Property

The field names that will be used by default for the network analyst class.

[Visual Basic .NET]
Public Sub set_CandidateFieldNames ( _
    ByVal FieldName As String, _
    ByVal A_2 As IStringArray _
)
[C#]
public void set_CandidateFieldNames (
    string FieldName,
    IStringArray A_2
);
[C++]
HRESULT putref_CandidateFieldNames(
  BSTR FieldName,
  IStringArray* 
);
[C++]

Parameters FieldName [in] FieldName is a parameter of type BSTR [in]
is a parameter of type IStringArray

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server. Requires Network Analyst Extension.

Remarks

CandidateFieldNames returns an IStringArray that contains an array of field names that are used to provide hints to the NAClassFieldMap for how to map input fields to fields on the NAClass.

This property is OK to be set at any time.

[C#]

This example illustrates how to add candidate fields to the "Incidents" NAClassDefinition that can then be automatically mapped when loading network locations.

 

  // Get the NAClass for "Incidents"
  INAClass incidentsNAClass=naLayer.Context.NAClasses.get_ItemByName("Incidents") as INAClass;
  // Get the current Candidate Fields and add a couple more values
  IStringArray candidateFields=incidentsNAClass.ClassDefinition.get_CandidateFieldNames("Name");
  candidateFields.Add("RestaurantName");
  candidateFields.Add("Restaurant");
  // Set the class to have the new candidate fields  
  INAClassDefinitionEdit naClassDefinitionEdit=incidentsNAClass.ClassDefinition as INAClassDefinitionEdit;
  naClassDefinitionEdit.set_CandidateFieldNames("Name", candidateFields);

 

[Visual Basic .NET]

This example illustrates how to add candidate fields to the "Incidents" NAClassDefinition that can then be automatically mapped when loading network locations.

 

  ' Get the NAClass for "Incidents"
  Dim incidentsNAClass As INAClass=naLayer.Context.NAClasses.ItemByName("Incidents")
  ' Get the current Candidate Fields and add a couple more values
  Dim candidateFields As IStringArray=incidentsNAClass.ClassDefinition.CandidateFieldNames("Name")
  candidateFields.Add("RestaurantName")
  candidateFields.Add("Restaurant")
  ' Set the class to have the new candidate fields  
  Dim naClassDefinitionEdit As INAClassDefinitionEdit=incidentsNAClass.ClassDefinition
  naClassDefinitionEdit.CandidateFieldNames("Name")=candidateFields


 

See Also

INAClassDefinitionEdit Interface