Expressions: IsEmpty shows same result in pop-up for every row

10-01-2021 03:55 AM
Labels (1)
New Contributor


I'm trying to hide empty fields in a pop-up with a expression:


var geboortedatum2 = "Geb. " + $feature.GEBOORTED2;
var overledendatum2 = "Overl. " + $feature.OVERLIJDE2;
IIf(IsEmpty($feature.OVERLIJDE2),"",geboortedatum2 + TextFormatting.NewLine + overledendatum2);


The pop-up doesn't seem to use my expression.
In the attachement you can see that it always shows the string info, regardless an empty row or not.

What am I doing wrong?

Thanks in advance!

0 Kudos
2 Replies
MVP Frequent Contributor

Expression looks good. My guess would be that your "empty" fields aren't really empty (null or "") but have some value like " " in them.

Have a great day!
0 Kudos
New Contributor III

I would suggest setting a variable for IsEmpty($feature.OVERLIJDE2) and console the output.

var empty = IsEmpty($feature.OVERLIJDE2)


This will console either true or false.  Doing this, you may find fields you think are NULL are actually blank (AKA '').

Otherwise, I've also found setting the ImEmpty to a variable and using that as the test in the IIF works better.

var empty = IsEmpty($feature.OVERLIJDE2)


IIF(empty == true,'True','False')

Hope this helps!

0 Kudos