Get names and types of all the fields of all the layers of a service

1192
4
11-16-2011 04:10 AM
TiagoRibeiro
Occasional Contributor
Hi there,

In my application, I want to create the following functionality:
I have two comboboxes, and I want to fill the first with all the layers from a service. After the user selects the layer the second has to show all the fields for that layer. Finally, after the user selects the  the field I want to know the type of that field in order to show the appropriate type of input to perform a query.
I already can fill the comboboxes, but I'm struggling in getting the field type. I'm using always ArcGISDynamicMapServiceLayer. Can I do it with FeatureLayers?
Any good ideas in how to better accomplish this will be much appreciated.
0 Kudos
4 Replies
derekswingley1
Frequent Contributor
I recommend using esri.request to get your layer's info, including all the field info, and then building your UI. There's an example of grabbing info for a layer in this post:  http://forums.arcgis.com/threads/7793-Identify-How-to-show-Alias-filed-instead-of-Field-Name?p=24158...
0 Kudos
TiagoRibeiro
Occasional Contributor
I recommend using esri.request to get your layer's info, including all the field info, and then building your UI. There's an example of grabbing info for a layer in this post:  http://forums.arcgis.com/threads/7793-Identify-How-to-show-Alias-filed-instead-of-Field-Name?p=24158...


Thanks a lot Derek, esri.request gives me exactly the information I need.

I was curios and searched inside the API reference the esri namespace the request method, and the information that exists about the possible options isn't very complete, at least in your example you use "callbackParamName" option (that I don't really know what its for), and it doesn't appear in the reference. Where can I see the complete list of avaible options? Could you had it to the online reference?

Thanks again!
0 Kudos
derekswingley1
Frequent Contributor
esri.request is actually a wrapper around dojo.io.script.get and dojo.xhrPost. This is mentioned in our docs for esri.request. Please refer to the dojo docs for more info on specific parameters like callbackParamName.
0 Kudos
TiagoRibeiro
Occasional Contributor
esri.request is actually a wrapper around dojo.io.script.get and dojo.xhrPost. This is mentioned in our docs for esri.request. Please refer to the dojo docs for more info on specific parameters like callbackParamName.


Ok I'll check those links.
If I may, I think it would be helpful to add the links you gave me to the API reference.

Thanks once again.
0 Kudos