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
Thank you so much for every contributors
Cheers
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 ""
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.
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.
Only one field is necessary?
Vbscript
Function FindLabel ( [Enabled] ) if [Enabled] = "False" then FindLabel = "ALERT" else FindLabel = "Enabled" end if End Function<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
or
<SPAN class="keyword token">def</SPAN> FindLabel <SPAN class="punctuation token">(</SPAN> <SPAN class="punctuation token">[</SPAN>Enabled<SPAN class="punctuation token">]</SPAN> <SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">[</SPAN>Enabled<SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">==</SPAN> <SPAN class="string token">'False'</SPAN> <SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">return</SPAN> <SPAN class="string token">"ALERT"</SPAN> <SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">return</SPAN> <SPAN class="string token">"Enabled"</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.