Dynamic Identify Task - Getting fields names and values dynamically.

1014
1
11-02-2011 05:36 AM
TiagoRibeiro
Occasional Contributor
Hi everyone,

I'm trying to to create a dynamic identify. The idea is to emulate as close as possible the identify experience from ArcGis desktop.
So far I've been able to connect to the map to obtain the active services, then cycle trough them to know the witch layers are visible, and now I'm in the process of figuring out how to access the attributes (name and value). Is it possible to access this information, without knowing in advance witch fields are going to be returned? I know that the information is under the result.feature.attributes.*, but can you help me in cycling trough this information? This has to be a really generic function so that it works with any layer without prior coding or configuration.

Thanks.
0 Kudos
1 Reply
TiagoRibeiro
Occasional Contributor
Hi everyone,

I'm trying to to create a dynamic identify. The idea is to emulate as close as possible the identify experience from ArcGis desktop.
So far I've been able to connect to the map to obtain the active services, then cycle trough them to know the witch layers are visible, and now I'm in the process of figuring out how to access the attributes (name and value). Is it possible to access this information, without knowing in advance witch fields are going to be returned? I know that the information is under the result.feature.attributes.*, but can you help me in cycling trough this information? This has to be a really generic function so that it works with any layer without prior coding or configuration.

Thanks.


Hi again,

I managed to work something out with this:
for (var attribute in results.feature.attributes)
 {
  if(attribute.toString().toUpperCase() != "SHAPE")
  {
   console.log(attribute + " - " + results.feature.attributes[attribute]);
  }
 }


It gives out the information I need. If someone has a more elegant idea, please let me know!