Transfer field value

652
2
05-20-2010 02:35 AM
tommykurniawan
New Contributor
I'm try to use field value, from searching result for another javascript calculation.
Could someone help me, on how to transfer those field value from code like below,

var infoTemplate = new esri.InfoTemplate("Info:${Desc}","${Diameter}");

I need to use the  value of ${Diameter}, into javascript variable.

Thank you.
0 Kudos
2 Replies
DerekSwingley
Occasional Contributor
Diameter is an attribute for your graphics, correct? If so, when you have access to your graphic, do this:
var dia = graphic.attributes.Diameter;
0 Kudos
tommykurniawan
New Contributor
Diameter is an attribute for your graphics, correct? If so, when you have access to your graphic, do this:
var dia = graphic.attributes.Diameter;


Derek Swingley , Thank you for reponse, i've just found the solution.
by adding the code for accessing the attributes value.

var featureAttributes = featureSet.features[0].attributes;
diam=featureAttributes['Diameter'];
0 Kudos