labelExpression With NULL Fields

222
3
07-10-2019 07:22 AM
RodrigoFelga
New Contributor III

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

[FIELD1] CONCAT [FIELD2]

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
Noah-Sager
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
IgorDolbik-Vorobey1
New Contributor

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

Thanks

0 Kudos
Noah-Sager
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