Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression field of list box generates empty value

I'm using a field expression to generate a combination of first and last name seperated by a comma:

= [Last Name]  & ', ' & [First Name]

Strange thing is that, depending on the machine I open the document, sometimes it generates an empty value ( " , ").

When selecting the empty value, it is all records are shown.

screenshot_school.png

If I leave out the fixed text ( = [Last Name] & [First Name] ) the empty value is gone.

Then if I open the same document on a other PC, this empty value is also gone.

What is causing this effect?

Is it a usersetting?

Is it a bug?

anybody an idea?

Thanks

5 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

I'm going to guess that some of the machine you are using, are 32 bit machines, and other machines are 64 bit machines. What could be happening is - those two environments treat NULL values differently.

The expression "First Name" & "Last Name" will likely produce an empty string or a NULL result for those data elements that are not associated with any valid names.

The expression "First Name" & ', ' & "Last Name" could produce NULL (most likely, on 64 bit machines) or a non-NULL value ", " (most likely, on a 32-bit machine) because 32 bit environments are more "forgiving" to your NULLs.

This is, of course, just a speculation, based on a similar behavior that I've seen before.

cheers,

Oleg Troyansky

Not applicable
Author

Hey Oleg,

Thank you very much for your answer.

You are exactly right with the 64 and 32 bit machines.

But how can this be avoided?

Hans

nagaiank
Specialist III
Specialist III

You may use the following expression:

=If(Len(Trim([Last Name]))>0 or Len(Trim([First Name]))>0, [Last Name]  & ', ' & [First Name], Null())

Not applicable
Author

Thank you for this expression.

But these are all solutions AFTER the damage is done.

There are no NULL values in [Last Name]  or [First Name]

The line with NULL values is only been generated on a 32 bit machine, when a fixed string is concatinated into the string.

Apparently, this NULL line is also linked (in one way or another) to ALL the possible values generated to the expression. This can be tested by selecting this NULL line, which causes to select all the data.

Probably, in some documents, this line comes in very handy.

So in my opinion, there should be a setting that you can change in order to avoid the generation of this line.

And maybe there is?

Greetings

Hans

Jason_Michaelides
Luminary Alumni
Luminary Alumni

Have you considered creating the FullName field in the script?  May avoid this alltogether and will most likely be more efficient.

Hope this helps,

Jason