Select to view content in your preferred language

Query.Outfields - reading aliases from the Map document

1091
3
09-06-2010 11:20 PM
StephenLead
Honored Contributor
The Query help page at http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jsapi_start.htm#jsapi/query.htm says:

"Outfields - You must list the actual field names rather than the alias names... However, you are able  to use the alias names when you display the results. You can set field  alias names in the map document"

All of the samples use hard-coded alias names, eg:

infoTemplate.setContent("<b>2000 Population: </b>${POP2000}<br/>"

Does anyone know the syntax to retrieve the field alias programatically from the ArcGIS Server services endpoint?

ie, rather than hard-coding 2000 Population, how could you retrieve it from the ${POP2000} parameter? I'm trying to write a generic query function which can be used by multiple layers, with different schemas.

Thanks,
Steve
0 Kudos
3 Replies
derekswingley1
Deactivated User
0 Kudos
StephenLead
Honored Contributor
Thanks for the info Derek.

I actually found an easier way - the QueryTask.Execute method returns a FeatureSet, which returns the fieldAliases.

http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jsapi_start.htm#jsapi/featureset.htm#fieldAl...

Cheers,
Steve
0 Kudos
derekswingley1
Deactivated User
Nice, not sure how I missed that previously...
0 Kudos