I tried making an arcade expression for my labels. While they don't fail and return an expected result, the labels never appear on the map. It's just blank?!
Labels are turned on, and for all levels
It's an ArcGIS Online map consuming an AGS feature layer
Any ideas why this wont work?
Solved! Go to Solution.
A couple of things:
First, IIF() is used incorrectly in your expression. The second and third parameters should be values, not statements. The correct syntax would be the following:
var label = '';
label += IIF($feature.OPZ == 'Yes', ' OPZ ', ' 1');
label += IIF($feature.Zoning == 'Yes', ' Z', ' 2');
label += IIF($feature.PlanSubCondo == 'Yes', ' PSD/C', ' 3');
label += IIF($feature.PLC == 'Yes', ' PLC', ' 4');
label += IIF($feature.ResDemo == 'Yes', ' RD', ' 5');
label += IIF($feature.SitePlan == 'Yes', ' SP', ' 6');
return label
Here's the documentation: Logical Functions | ArcGIS for Developers
Second, the labels not appearing is heard to diagnose without a link to a webmap or a simple JS application. Could you provide one?
A couple of things:
First, IIF() is used incorrectly in your expression. The second and third parameters should be values, not statements. The correct syntax would be the following:
var label = '';
label += IIF($feature.OPZ == 'Yes', ' OPZ ', ' 1');
label += IIF($feature.Zoning == 'Yes', ' Z', ' 2');
label += IIF($feature.PlanSubCondo == 'Yes', ' PSD/C', ' 3');
label += IIF($feature.PLC == 'Yes', ' PLC', ' 4');
label += IIF($feature.ResDemo == 'Yes', ' RD', ' 5');
label += IIF($feature.SitePlan == 'Yes', ' SP', ' 6');
return label
Here's the documentation: Logical Functions | ArcGIS for Developers
Second, the labels not appearing is heard to diagnose without a link to a webmap or a simple JS application. Could you provide one?
Thanks your code worked fine and appears on the map as expected.
I'm not the best coder... I guess what threw me off is that the TEST was successful, even thought I am supposed to be using a values not statements as you said... It was probably not showing on the map for this reason alone.
I think it's an issue with the playground. It should throw an error in that situation, but doesn't. Several others have run into the same issue with IIF().