labelExpression With NULL Fields

07-10-2019 07:22 AM
New Contributor III

I'm labeling a layer dinamicaly with 2 fields selcted by user. I create a labelExpression like that:


When the user selects 2 required fields the labeling works great. When the user selects 1 required field and 1 not required field the label don't show for all features. I think because FIELD2 in the second case has null values.

Any help will be apreciated.

3 Replies
Esri Regular Contributor

You could try the DefaultValue Arcade expression:

Logical Functions | ArcGIS for Developers 

Which we use in this sample for features that are missing data:

ArcGIS API for JavaScript Sandbox 

0 Kudos
New Contributor

This only works with FeatureLayer. How to make this work with MapImageLayer?


0 Kudos
Esri Regular Contributor

This would require some SQL logic, possibly using a combination of the labelExpression and the where properties. I just tried but couldn't get it working yet. Will continue to investigate.

0 Kudos