Select to view content in your preferred language

Help converting VB Script ot Arcade

682
1
Jump to solution
03-17-2022 01:22 PM
AaronScott2
Emerging Contributor

I need help converting a VB Script label expression to Arcade

Function FindLabel ( [RoadName] , [RoadNumber] )
if [RoadName] = "" then
FindLabel = [RoadNumber]
else FindLabel = [RoadName]
end if
End Function

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

The Arcade Playground is a great place to try things out. What you're doing here is similar to the Arcade function DefaultValue, in which a field is returned, but does something else if that field is null. In this case, you'd like the road number returned in that instance. This should do it:

return DefaultValue($feature['RoadName'], $feature['RoadNumber'])

 

- Josh Carlson
Kendall County GIS

View solution in original post

1 Reply
jcarlson
MVP Esteemed Contributor

The Arcade Playground is a great place to try things out. What you're doing here is similar to the Arcade function DefaultValue, in which a field is returned, but does something else if that field is null. In this case, you'd like the road number returned in that instance. This should do it:

return DefaultValue($feature['RoadName'], $feature['RoadNumber'])

 

- Josh Carlson
Kendall County GIS