ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer
GetAddressFields Method
See Also  Example
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer Namespace > GeocodeFunctionality Class : GetAddressFields Method




Obtains a list of the fields that may be used as inputs for geocoding.

Syntax

Visual Basic (Declaration) 
Public Function GetAddressFields() As List(Of Field)
Visual Basic (Usage)Copy Code
Dim instance As GeocodeFunctionality
Dim value As List(Of Field)
 
value = instance.GetAddressFields()
C# 
public List<Field> GetAddressFields()

Example

This example prints out several properties of each address field in the geocoding service.
C#Copy Code
private void DisplayAddressFields( 

    ESRI.ArcGIS.ADF.Web.UI.WebControls.GeocodeResourceManager resourceManager, 

    System.Web.UI.WebControls.Label lblControl) 



    ESRI.ArcGIS.ADF.Web.DataSources.IGeocodeResource geoRes 

        = resourceManager.GetResource(0); 

  

    if (!geoRes.Initialized) 

        geoRes.Initialize(); 

  

    ESRI.ArcGIS.ADF.Web.DataSources.IGeocodeFunctionality geoFunct = 

        (ESRI.ArcGIS.ADF.Web.DataSources.IGeocodeFunctionality) 

        geoRes.CreateFunctionality( 

        typeof(ESRI.ArcGIS.ADF.Web.DataSources.IGeocodeFunctionality), "geoFunct"); 

    if (!geoFunct.Initialized) 

        geoFunct.Initialize(); 

  

    System.Text.StringBuilder sb = new System.Text.StringBuilder( 

        "Fields:"); 

    List<ESRI.ArcGIS.ADF.Web.Geocode.Field> flds = geoFunct.GetAddressFields(); 

    foreach (ESRI.ArcGIS.ADF.Web.Geocode.Field field in flds) 

    { 

        sb.AppendFormat("<br/>Name: {0}, type: {1}, required: {2}", field.Name, 

            field.Type, field.Required); 

    } 

    lblControl.Text = sb.ToString(); 



    
Visual BasicCopy Code
Private Sub DisplayAddressFields(ByVal resourceManager As _

    ESRI.ArcGIS.ADF.Web.UI.WebControls.GeocodeResourceManager, _

    ByVal lblControl As System.Web.UI.WebControls.Label



    Dim geoRes As ESRI.ArcGIS.ADF.Web.DataSources.IGeocodeResource = _

        resourceManager.GetResource(0)



    If Not geoRes.Initialized Then

        geoRes.Initialize()

    End If



    ESRI.ArcGIS.ADF.Web.DataSources.IGeocodeFunctionality geoFunct = _

        CType(geoRes.CreateFunctionality( _

        GetType(ESRI.ArcGIS.ADF.Web.DataSources.IGeocodeFunctionality), "geoFunct"), _

        ESRI.ArcGIS.ADF.Web.DataSources.IGeocodeFunctionality)

    If Not geoFunct.Initialized Then

        geoFunct.Initialize()

    End If



    Dim sb As New System.Text.StringBuilder("Fields:")

    Dim flds As List(Of ESRI.ArcGIS.ADF.Web.Geocode.Field) = geoFunct.GetAddressFields()

    Dim field As ESRI.ArcGIS.ADF.Web.Geocode.Field

    For Each field In flds

        sb.AppendFormat("<br/>Name: {0}, type: {1}, required: {2}", field.Name, _

            field.Type, field.Required)

    Next

    lblControl.Text = sb.ToString()

End Function

Remarks

Each item in the returned list is a Field that has the field name, data type, whether required, etc. This information guides the information that should be provided when performing geocoding with GeocodeAddress or FindAddressCandidates. For each field (or at least required fields), an AddressValue object should be created and added to the list to pass to the geocoding method. The Field's Name may be used as the AddressValue's FieldID.

See Also

© 2010 All Rights Reserved.