AnsweredAssumed Answered

Why isn't my Arcade expression returning a label in ArcGIS online (despite testing successfully)?

Question asked by rblash on May 21, 2019
Latest reply on May 22, 2019 by xander_bakker

I wrote the label expression below to look at pipe length and cross section shape to determine if and how a label is generated for a pipe. It works fine in ArcGIS Pro, and when I paste the expression into ArcGIS Online the code validates and returns a test string as expected (for both label functions in the expression).

 

However, no labels are displaying on the map. I have a similar (and more simple) function that is working just fine.

 

function ChooseLabelFormat(ML,PL,Sec){
//Calls the label function based on pipe shape
    return When(
    PL >= ML && Sec == 'Circular', GetMainLabel ($feature.NominalDiameter,$feature.Material),
    PL >= ML && Sec != 'Circular', GetMainLabelNC ($feature.Material,$feature.BoxHeight,$feature.BoxWidth),
    "")
};

function GetMainLabel(Dia,Mat){
//Returns Diameter and/or material excluding -999 and Unk values
    return When(
    Dia !=-999 && Mat != "Unk", Dia + "'' " + Mat,
    Dia !=-999 && Mat == "Unk", Dia + "''",
    Dia ==-999 && Mat != "Unk", Mat,
    "")
};

function GetMainLabelNC(Mat,BH,BW){
//Returns HeightxWidth and/or material excluding -999 and Unk values
    return When(
    BH !=-999 && Mat != "Unk", BH + "'' x " + BW + "'' " + Mat,
    BH !=-999 && Mat == "Unk", BH + "'' x " + BW + "'' ",
    BH ==-999 && Mat != "Unk", Mat,
    "")
};

//Set variables and call function for labeleling
var Section = DomainName($feature, 'CrossSectionShape');
// Set MinLabel value as the minimum feature length to be labeled:
var MinLabel = 50;
var PipeLen = $feature.SHAPE__Length; //var PipeLen = Length(Geometry($feature), 'feet')

return ChooseLabelFormat(MinLabel,PipeLen,Section);

Outcomes