Hi,
I am looking to create a label expression that will result in the following: display 'Enabled', however if 'Enabled' is "False", display 'Status' label as "ALERT" .
Somethings like as below
Only one field is necessary?
Vbscript
Function FindLabel ( [Enabled] )
if [Enabled] = "False" then
FindLabel = "ALERT"
else
FindLabel = "Enabled"
end if
End Function
or
Python
def FindLabel ( [Enabled] ):
if [Enabled] == 'False' :
return "ALERT"
else:
return "Enabled"
Dear Ted, i really thank you. In fact you right i totally forgot, so yes i need also second one because when i applied that script on my map screen showing like as below.
So is there any way to just show if "Enabled" field is 'False' and when "Status" field is 'Normal' retention for 'Enabled' label. I do not want to show that Enabled label on the map because everything is allright.
thanks in advance.
You can do it through code, like Ted mentions (return "" if you don't want a label), or set an SQL query to filter the features you want labelled.
Like Darren Wiens mentioned filtering or modify my script above to return a blank string for the label (this happens when enabled is true -- actually it would happen if enabled is anything else except false)
vbscript
Else
FindLabel = ""
---------------------------------
Python
else:
return ""
Thank you so much for every contributors
Cheers