Hello,
I have a hosted feature layer that has a call sign.
I also have a hosted table layer with the call sign and unit status.
What I would like to do is use the values from the table layer to determine whether the call sign will be white or red text based on the value from unit status.
Is there an Arcade expression that would allow me to do this?
Thank you
Mele
Getting data from another layer or table like that isn't allowed in label expressions to avoid performance issues. If you have access to Attribute Rules you can calculate a color every time the call sign changes and store it in a field, or even calculate the entire label ahead of time. If not, you can write a lookup table into the label expression and update it by hand as new data comes in. Something like:
var color = "red='128' green='128' blue='128'";
var color_red = "red='255' green='0' blue='0'";
var color_white = "red='255' green='255' blue='255'";
var lookup = {
"A1": color_red,
"A2": color_red,
"B1": color_white,
"B2": color_red
};
var cs = $feature.call_sign;
if (HasKey(lookup, cs)) {
color = lookup[cs];
}
return `<CLR ${color}>${cs}</CLR>`