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

filling NULL values created as a result of the generation of field value combinations

Hi,

As the question says, I have a table that has null values due to the field values not matching up. I want to fill the empty fields with something else. As the actual data in the fields are not null, I believe I should be doing this in the expression. The formula I used is

if (isnull ([Country]), 'Rest of the world', [Country])

However, it is not working. How should I do this?

1 Solution

Accepted Solutions
karthikoffi27se
Creator III
Creator III

Hi Chan,

I guess they are missing values rather then Null values.Please confirm by counting the missing value with the below expression


Missingcount(Expression)

try using this two

if(not isnull(expression),expression,'!')

or

if(len(trim(expression))>0,expression,'!')

Many Thanks

Karthik

View solution in original post

10 Replies
karthikoffi27se
Creator III
Creator III

Hi Chan,

please define the NULL in the load script.

and then you can use the If condition to input your dimension value.

NULLASVALUE *;

SET vNullvalue = '<Null>';

Many Thanks

Karthik

rahulpawarb
Specialist III
Specialist III

May be try this:

=if(Len([Country])>0, [Country], 'Rest of the world')

Regards!

Rahul Pawar

Not applicable
Author

Hi,

I added it into the script but it didn't work. Is there any specific place i should put it at? Also the column is not actually null in the first place. The reason why the column is null in the table is because the key between the 2 tables in the database do not match sometimes.

Thanks!

Not applicable
Author

Hi,

It did not work, probably because the fields are null and has no value? Anyway if i switch them around like this:

=if(Len([Country])>0, 'Rest of the world', [Country])

The fields that originally had results in them changed but the null fields were still blank. Any idea why?

Thanks!

rahulpawarb
Specialist III
Specialist III

Could you please share the result of below expression for column value where it is NULL?

Len([Country])

Not applicable
Author

Hi,

As seen in the picture below, len([Country]) shows 0 for null fields. However, the field is still blank.

Capture.PNG

Thanks!

rahulpawarb
Specialist III
Specialist III

Considering above data below expression should work:

//Show 'Rest of the world' if country field value is null else show the available country value

=if(Len([Country])=0, 'Rest of the world', [Country])

karthikoffi27se
Creator III
Creator III

Hi Chan,

I guess they are missing values rather then Null values.Please confirm by counting the missing value with the below expression


Missingcount(Expression)

try using this two

if(not isnull(expression),expression,'!')

or

if(len(trim(expression))>0,expression,'!')

Many Thanks

Karthik

Not applicable
Author

Hi,

Strangely this does not work either. The field is still blank. However if I do the same on another table with the same field but under a different name, it works fine.

The difference between the tables is that in the table above, the data pulled is from the same source, but for the table in my question, the data is pulled from 2 sources.

Thanks!