cfarver

Having Trouble with Query outFields

Discussion created by cfarver on Jun 4, 2011
Latest reply on Jun 5, 2011 by cfarver
Hi,
I'm having a bit of trouble with query outfields. Specifically, I have been trying to save the value of a certain outField in a string var, and then do some action depending on what that value is.

I'm able to have the value print out in my map by using this code:
var cableTxt = "";
cable = "${cable}";
            
infoTemplate= new esri.InfoTemplate("${blah}", "Cable : " + cable " <br/>  ...");


Which currently is either a 1 or a 0.

What I want to do, is when I save the value of ${cable} into cableTxt, is call an if statement, changing cableText to be the corresponding english counterpart of 1 or 0.

So instead of having the infoTemplate print out..
Cable: 1
I would like to see..
Cable: Yes

I'm imagining something along the lines of
var cable = "";
cable = "${cable}";

if(cable == 1){
   cable = "Yes";
}

infoTemplate= new esri.InfoTemplate("${blah}", "Cable : " + cable + " <br/>  ...");


Is there a way to do this? Right now it recognizes ${cable} literally, but doesn't in the infotemplate which is confusing to me.

Thanks

Outcomes