Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Show results in straight table if a field in different columns is empty "NULL"

Dear community,

I've been puzzled with (probably) a simple question.

As the title says, I cannot seem to get data in a straight table if one of the colums has an empty field or NULL.

In the example below I wanted to show all lines if one of the fields is empty (Email, Function or Phone Number).

So i was trying to use the IF function in the expression but I cannot seem to get it working. The formula should look like

IF(Email='nul', OR Function='null', Or Phonenumber='null' then show all records)


Can anyone please assist?

Regards,

Sijmen

14 Replies
Not applicable
Author

Noone knows? Or is is not possible in QV?

ecolomer
Master II
Master II

You can try change Null by another sign '-' par example in the script of charge

Not applicable
Author

Thanks for the reply Enrique, I see what you are saying, but how do I code the IF statement even if I change the sign '-' to something else?

ecolomer
Master II
Master II

Realy you want see or non see the lines with fields nulls?

Not applicable
Author

Yes, the query is used to check if our data is complete.

So basically. Show the lines with data is one of the three fields is empty or null. Then we can look up the datasource file and fill in the empty fields.

Not applicable
Author

This doesn't seem to be nulls. It seems to be empty spaces.

So you can simply do the following in your script.

if(Email = '', 'NULL', Email) as Email

if(Phonenumber = '', 'NULL', Phonenumber) as Phonenumber

if(Function = '', 'NULL', Function) as Function

Regards,
Marius

Not applicable
Author

And then you can do the following in your expression.

sum(if(Email = 'NULL' or Phonenumber = 'NULL' or Function = 'NULL', 1))

Regards,
Marius

Not applicable
Author

I have attached another solution where you can do this in the front end.

The object's name is 'Marius'.

Regards,
Marius

tobias_klett
Partner - Creator II
Partner - Creator II

Hi Sijmen,

load the fields in the script like this:

Tablexy:

Load

     if(isnull(Email),'null',Email)                               as Email,

     if(isnull(Function),'null',Function)                     as Function,

     if(isnull(Phonenumber),'null',Phonenumber)    as Phonenumber,

...

You could also do a flag for datasets with one null value like this

     if(isnull(Email) or isnull(Function) or isnull(Phonenumber),1,0) as Null_Flag,

Afterwards you can select the desired null-values or the Flag_Field and alternatively use Set Analysis to show the chart:

only( {<Null_Flag={1}>} FieldXY)

Hope this helps

Tobias