Select to view content in your preferred language

Having Trouble with Query outFields

563
2
06-04-2011 10:40 AM
ChrisFarver
Emerging Contributor
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
0 Kudos
2 Replies
StephenLead
Honored Contributor
0 Kudos
ChrisFarver
Emerging Contributor
Thanks for the reply. I'll take a look
0 Kudos