Select to view content in your preferred language

Getting a value from feature

474
1
12-23-2012 08:14 PM
PrasannaRaghavendar
Occasional Contributor
Please do explain me the meaning of these statements.
bldgResults = {displayFieldName:null,features:[]};
parcelResults = {displayFieldName:null,features:[]};



These are present in the addToMap(idResults, evt) method of the sample given in the link
http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/find_drilldown...

Also please do let me know if this would get me the "UNIQPOLYID" from feature.
  identifyTask.execute(identifyParams, function(result) { 
   var polyID = result.feature.attributes["UNIQPOLYID"]; 
  });


Thanks
Prasanna
0 Kudos
1 Reply
JohnGravois
Deactivated User
hi Prasanna,

the first code block clears out the bldgResults and parcelResults variables just in case the identifyTask has already been run (so that previous results won't appear again).

because the identify returns an array of results, you either have to loop through them or specify the index position of one of the items in the array in order to retrieve attributes of individual features.  in these sorts of scenarios it is extremely helpful to set a breakpoint in the code using browser developers tools and interrogate variables in the console to see whats going on.

in the screenshot i attached i set a breakpoint at the beginning of the addToMap function.  the first feature that gets returned does not include a "UNIQPOLYID" field, so a call to retrieve it will return "undefined".
0 Kudos