I have a numerical attribute field containing integer values and would like to have the label expression display a corresponding value for each integer. I have created a dictionary representing these values.
However, the label expression dialogue indicates an error in line 2: Invalid Key. I cannot see anything wrong with the format of the dictionary based on other examples found within the forums.
The Arcade expression is shown below.
var stuff = {
0: "SCC",
101: "SEP",
4: "CLT",
23: "CGS",
8: "CTR",
7: "CTH",
14: "DSW",
9: "ECT",
5: "FTH",
21: "GPS",
10: "GSL",
3: "ITH",
22: "ITS",
13: "ISH",
20: "OSR",
17: "PTC",
26: "PCT",
24: "SAL",
18: "STC",
15: "SWR",
19: "STR",
6: "TFA",
12: "3SS",
11: "2SS",
100: "GPE",
25: "WHI",
102: "RET",
103: "TSI",
104: "POL"
};
var keyField = "Type"; //this is the attribute field with the integer values
var lookupKey = $feature[keyField];
var lookupResult = Dictionary(stuff)[lookupKey];