On a Point layer, i want to create a label, where if certain attributes have been entered, Then add those aswell.
2x relevant fields are:
IA_Cause - A dropdown / Domain list containing text reasons for the point
DTI - Text field, But, Eventually will be updated to be numeric (to only allow XX.X numbers)
I would like the IA_Cause to be the default label for the points.
However, IF a value has been added to the "DTI" field, i would also like that added to the label.
And IF the DTI field has a value, i would like to add "m" to the end of the DTI Value.
In an example, where a point without a DTI value added to the feature would just be labeled:
"Because of reasons"
In an example where the same point had "21.6" added to the DTI Attribute
"Because of reasons 21.6m"
I Currently use:
The issue with the formula is:
Where a point is added with ONLY the "IA_Cause" and NO DTI value, The label automatically adds an 'm' at the end, so i end up with a label saying "Because of reasonsm"
Solved! Go to Solution.
This is a great reason to use Arcade. Here is some Arcade you can apply to your label settings. I have also added a text conversion to the DTI field so that if you do eventually change this to a numeric field it will still work.
var ia = $feature["IA_Cause"];
var dti = $feature["DTI"];
var label;
if (IsEmpty(dti) == false) {
label = ia + " " + Text(dti) + "m";
} else {
label = ia;
};
return label;
This is a great reason to use Arcade. Here is some Arcade you can apply to your label settings. I have also added a text conversion to the DTI field so that if you do eventually change this to a numeric field it will still work.
var ia = $feature["IA_Cause"];
var dti = $feature["DTI"];
var label;
if (IsEmpty(dti) == false) {
label = ia + " " + Text(dti) + "m";
} else {
label = ia;
};
return label;
Absolutely stunning! Thank you very much.