Select to view content in your preferred language

Transfer field value

832
2
05-20-2010 02:35 AM
tommykurniawan
Emerging 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
Regular 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
Emerging 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