AnsweredAssumed Answered

Is it possible to use an If Then Else statement in ArcGIS Online Label Expression

Question asked by durshe on May 30, 2017
Latest reply on May 30, 2017 by durshe

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?



Eugene D.