Arcade Error: Runtime Error

851
3
Jump to solution
07-15-2021 08:30 AM
LisaHo
by
New Contributor

i have created a web map and i don't want the walls and stairs to be labeled, only the rooms.
When I take this code for the labeling it comes "Execution Error:Runtime Error: ".
Can you help me further?

LisaHo_0-1626362987178.png

 

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

I'd recommend reviewing the Structure and Logic page of the Arcade guide, as it goes over some of the specifics for how Arcade works. Regarding your expression:

  • Use return instead of print to return a value
  • You don't need to return an empty string for features you don't want labeled, simply leave them out of the expression entirely
  • A logical 'AND' in Arcade is &&
  • Your if statement appears to be filtering the opposite to your stated intent

Rewriting your expression, it might look like this:

var n = $feature.name

if(n != 'Wand' && n != 'Treppe'){
    return n
}

 

Do you need your map to be in the Classic viewer? Note that in the new version of the Map Viewer, you can apply filters to your label class and avoid this altogether.

- Josh Carlson
Kendall County GIS

View solution in original post

3 Replies
jcarlson
MVP Esteemed Contributor

I'd recommend reviewing the Structure and Logic page of the Arcade guide, as it goes over some of the specifics for how Arcade works. Regarding your expression:

  • Use return instead of print to return a value
  • You don't need to return an empty string for features you don't want labeled, simply leave them out of the expression entirely
  • A logical 'AND' in Arcade is &&
  • Your if statement appears to be filtering the opposite to your stated intent

Rewriting your expression, it might look like this:

var n = $feature.name

if(n != 'Wand' && n != 'Treppe'){
    return n
}

 

Do you need your map to be in the Classic viewer? Note that in the new version of the Map Viewer, you can apply filters to your label class and avoid this altogether.

- Josh Carlson
Kendall County GIS
LisaHo
by
New Contributor

Thank you very much, now I got it.
I need to make it a web app since I'm working with Indoors 🙂

 

JoeBorgione
MVP Emeritus

What is the 'print' statement you are using?  Replace that with 'return' and see if that works for you:

 

 

if ($feature["USER_RECEIPT_NU"] == 8967){
    return('')
}
else{
    return($feature["USER_ID_NUMBER"])
}

 

 

I just whipped this up on some data I have in AGOL...

 

That should just about do it....
0 Kudos