arcade labels dont show

695
3
Jump to solution
11-01-2017 12:57 PM
AwesomeEvan
Occasional Contributor

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?

0 Kudos
1 Solution

Accepted Solutions
KristianEkenes
Esri Regular Contributor

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?

View solution in original post

3 Replies
KristianEkenes
Esri Regular Contributor

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?

AwesomeEvan
Occasional Contributor

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.

0 Kudos
KristianEkenes
Esri Regular Contributor

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().

0 Kudos