Select to view content in your preferred language

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

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

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!



0 Kudos
2 Replies
JohannesLindner
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!
Johannes
0 Kudos
JasonGlidewell
Occasional Contributor

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!

0 Kudos