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.
Solved! Go to Solution.
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, '')
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.'
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, '')
@JayantaPoddarThis was the solution that labeled the features correctly and published to AGOL. Thanks!