I'm trying to get this popup expression to work in ArcGIS Online using ArcGIS Arcade.

if ($feature["Road_Work_Ahead_Deployed"] >= 1){
    return "Road Work Ahead Deployed: " + $feature["Road_Work_Ahead_Deployed"]
+ TextFormatting.NewLine + 
if ($feature["LCA_Velcro_Deployed"] >= 1){
    return "LCA Velcro: " + $feature["LCA_Velcro_Deployed"]

I do something very similar in ArcMap using VBscript but I can't seem to make it work in ArcGIS Arcade. Is it possible to chain statements together like this in one expression?

2 Answers 2


Define a string variable, build it out, and return it at the end, instead of multiple returns:

var result = ""
if ($feature["Road_Work_Ahead_Deployed"] >= 1){
    result += "Road Work Ahead Deployed: " + $feature["Road_Work_Ahead_Deployed"]

if (($feature["Road_Work_Ahead_Deployed"] >= 1) && ($feature["LCA_Velcro_Deployed"] >= 1)){
    result += TextFormatting.NewLine
if ($feature["LCA_Velcro_Deployed"] >= 1){
    result += "LCA Velcro: " + $feature["LCA_Velcro_Deployed"]
return result
  • Thank you this is perfect, instead of the second if statement though I'll add the line break into the result for each statement. I need to add more if statements than just the two I posted as an example.
    – Ryan
    Commented Sep 7, 2022 at 16:38

You can use the IIf() function and return an empty string ("") or null when the condition is false, and use Concatenate() to join both terms (although the + operator also works):

var var1 = $feature["Road_Work_Ahead_Deployed"]
var str1 = IIf(var1 >= 1, "Road Work Ahead Deployed: " + var1, null)

var var2 = $feature["LCA_Velcro_Deployed"]
var str2 = IIf(var2 >= 1, "LCA Velcro: " + var2, null)

return Concatenate([str1, str2], TextFormatting.NewLine)
//OR: return str1 + TextFormatting.NewLine + str2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.