Hello
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!
Expression looks good. My guess would be that your "empty" fields aren't really empty (null or "") but have some value like " " in them.
I would suggest setting a variable for IsEmpty($feature.OVERLIJDE2) and console the output.
var empty = IsEmpty($feature.OVERLIJDE2)
Console(empty)
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)
Console(empty)
IIF(empty == true,'True','False')
Hope this helps!