Need help creating an Arcade Script for Labeling

186
3
Jump to solution
07-29-2021 01:48 PM
ScottRobinson
New Contributor III

I have a VBScript I've used for labeling in ArcMap:

Function FindLabel ( [FOREST] , [FTYPE] , [ACRES] )
If [FOREST] = "F" And [ACRES] > 2 Then
FindLabel = [FTYPE] &vbnewline& Round([ACRES],0) & " ac."
End If
End Function

Can someone help me turn this into an Arcade script?

Thanks.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
JayantaPoddar
MVP Esteemed Contributor

A similar expression should also work

 

var code = $feature.FOREST
var areas = $feature.ACRES
var expr = ($feature.FTYPE + '\n' + Round($feature.ACRES,0) + 'ac.')
IIF((code=='F' && areas > 2), expr, '')

 



Think Location

View solution in original post

0 Kudos
3 Replies
jcarlson
MVP Regular Contributor

You can just set a query statement on the label class to handle the "if" statement. Then the Arcade expression would just be

$feature["FTYPE"] + '\n' + Text($feature["ACRES"], '###,###') + 'ac.'
- Josh Carlson
Kendall County GIS
0 Kudos
JayantaPoddar
MVP Esteemed Contributor

A similar expression should also work

 

var code = $feature.FOREST
var areas = $feature.ACRES
var expr = ($feature.FTYPE + '\n' + Round($feature.ACRES,0) + 'ac.')
IIF((code=='F' && areas > 2), expr, '')

 



Think Location

View solution in original post

0 Kudos
ScottRobinson
New Contributor III

@JayantaPoddarThis was the solution that labeled the features correctly and published to AGOL.  Thanks!

0 Kudos