sondickerson

advanced label expression in Arcgis server doesn't label

Discussion created by sondickerson on Feb 11, 2013
Latest reply on Aug 30, 2013 by svenneglenne
I'd like to use the following advanced label expression for a layer in a map service.  This javascript function works in arcmap, but does not label the features when its published as a map service.  In the publishing preview window the labels do appear, but not in the finished service. 

function FindLabel ( [NPC_CATEGORY_ID] )
{

idArray=["231","371","372","375","376"];
codeArray=["WPn53","WMs83","WMs92","WPn53","WPn53"];
var labelValue = [NPC_CATEGORY_ID];

for (var i=0,l=idArray.length; i<l; i++)
{
   if  (idArray[i] ==  [NPC_CATEGORY_ID] ){
     labelValue = codeArray[i];
  }
}

return labelValue;


}


Although, it doesn't present a solution that I could use, the following thread is similar:
http://forums.arcgis.com/threads/70413-Handling-NULL-Dates-in-Labels?highlight=label


If you have any thoughts on this one, please let me know.
Thanks greatly,
Sonia

Outcomes