Labeling expressions on AGOL with Arcade for certain features

589
0
02-04-2019 02:59 AM
Aurelija_RutaViluckyte
New Contributor III

Hello there, 

 

I am working on a web map in AGOL for the indoor office map. I have some issues writing custom expressions with Arcade in order to label the types of rooms (office rooms) based on another attribute name. So I have 2 attributes, one is Room_type, which has at least 10 different values, and another attribute Name, which has the labels I need for different types of rooms. 

So what I want to do is to label only those room types that correspond to "Meeting" type, and labels should come from attribute "Name", because it contains the titles of each "Meeting" room type. 

I've been trying something like this, but it only returns Null values for me:

 

a)
var room_type = $feature["Room_type"]
var meetlabel = $feature.Name

If (room_type == 'Meeting') {
return meetlabel;
} else {
return 'None';
}

b)
iif ($feature["Room_type"] == 'Meeting', $feature.Name, 'None')

c)
If ($feature["Room_type"] == 'Meeting') {
return $feature.Name;
} else {
return 'None';
}

d) When( $feature["Room_type"] == 'Meeting', $feature.Name, 'None')

e) Decode( $feature["Room_type"], 'Meeting', $feature.Name, 'None')

 

So far I started thinking just to calculate a new field for each building floor that has the required labels in place with Field Calculator in Arcmap. But hopefully it's possible to do with Arcade, as it would definitely shorten my workload!

 

Thanks in advance for any tip!

 

Regards, 

Aurelija

0 Replies