AnsweredAssumed Answered

Passing in Field Name of evt.graphic.attributes

Question asked by KeitherJ on Jun 29, 2015
Latest reply on Jun 29, 2015 by KeitherJ

Folks

 

I am using

 

Layer.on("Click", function (evt){
var testval = evt.graphic.attributes.ADDRESS
}

 

to return the Feature value of the "ADDRESS" field.

testval results are fine.

 

My issue is I need to pass in a different Field each time a new FeatureLayer is activated.

I have the name of the Field prior to the on Click event.

What is the syntax....

 

fld = "NAME";

Layer.on("Click", function (evt){
var testval = "evt.graphic.attributes." + fld;
}

 

Alternative ideas welcome.

 

Thanks,

 

Keith

Outcomes