I'm attempting to add the following expression to a layer in AGOL, but not able to make it work...
Here's what I have in ArcGIS Desktop which works...
Function FindLabel ( [InspectionOrigin], [ClockFromTrans], [ClockFrom] )
if ( [InspectionOrigin] <> "D") then
FindLabel = ( [ClockFromTrans] )
elseif ( [InspectionOrigin] <> "U") then
FindLabel = [ClockFrom]
end if
End Function
I'm attempting to recreate this in AGOL for one of my layers and am unable to get it to work.
I've tried multiple options, none seem to be successful.
Option 1
IIf($feature.InspectionOrigin = Text($feature.InspectionOrigin, 'U'), $feature["ClockFromTrans"], $feature["ClockFrom"])
Option 2
IIf($feature.InspectionOrigin = 'U'), $feature["ClockFromTrans"], $feature["ClockFrom"])
Option 3
IIf($feature.InspectionOrigin <> 'D'), $feature["ClockFromTrans"], $feature["ClockFrom"])
Any thoughts?
Thanks!
Eugene D.
Solved! Go to Solution.
There are a couple way of doing this. First would be to use an If statement
if ( $feature.InspectionOrigin != "D") {
$feature.ClockFromTrans
}
else if ( $feature.InspectionOrigin != "U") {
$feature.ClockFrom
}
You can also use the logical function IIF
iif ($feature.InspectionOrigin != "D", $feature.ClockFromTrans, $feature.ClockFrom)
The documentation has more examples: ArcGIS Arcade | ArcGIS for Developers
There are a couple way of doing this. First would be to use an If statement
if ( $feature.InspectionOrigin != "D") {
$feature.ClockFromTrans
}
else if ( $feature.InspectionOrigin != "U") {
$feature.ClockFrom
}
You can also use the logical function IIF
iif ($feature.InspectionOrigin != "D", $feature.ClockFromTrans, $feature.ClockFrom)
The documentation has more examples: ArcGIS Arcade | ArcGIS for Developers
Thank you Ken. This was exactly what I was looking for. The first option (using the "if statement") worked well. I wasn't able to get the "iif statement" to label features successfully.
Again; thank you very much!
Eugene D.