Select to view content in your preferred language

Help with if statement in Aracde

03-30-2020 06:37 AM
Frequent Contributor III

I have a number of vehicles being tracked and the label field is a number for the Truck number.

I would to label the trucks based on who the assigned driver is.

The label field looks like

166 - PU HD

166 being the truck number. and I want to label is as "VOSS".  In Pro it is just fine to make label classes based on the truck numbers, but the map will not carry over to a web map.  Unless there is a way to make label classes for a web map

So I want to do

if($feature.label = "166 - PU HD", "VOSS", (if($feature.label = "186 - PU HD", "LANGLEY","none"))

I have looked at a number of examples but the are not working.

Tags (2)
0 Kudos
4 Replies
Esri Esteemed Contributor

Hey Robert,

Try the following:

IIf($feature.label == "166 - PU HD", "VOSS", "LANGLEY")‍‍‍‍


0 Kudos
Frequent Contributor III

thanks that's helped.

I am able to then continue on  with multiple iif statements.  I have 12 trucks to label

IIf($feature.label == "166 - PU HD", "VOSS", iif($feature.label == "154 - SUV HD","LANGLEY","None"))

0 Kudos
MVP Esteemed Contributor

If you have that many items, you should consider using a dictionary. 

Frequent Contributor III

I have never tried using a dictionary but I will look into it.

However, I was able to solve the issue. I asked our GIS Lead about creating a domain out of the driver_id and putting that in.  That actually was something he had thought we should do as there are other departments that use our AVL web map and others wanted to see names rather than truck numbers.  The Driver ID field in our AVL is a long integer field.  Adding a domain took a few seconds. 

0 Kudos