Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Drake
Contributor
Contributor

Handling Nulls

Hi All, I have a requirement in the front end. We have tables whose data source contains numbers, zeros, and null values. In the tables, I need to display the values as they are, display zeros as zeros, and represent null values as either null or dash (-). Similarly, we have other tables/charts with different data sources that also need to be adjusted accordingly. Could you please advise on how to accomplish this within the individual tables, also it is possible in the data load process also. Thanks

Labels (3)
3 Replies
JonnyPoole
Employee
Employee

The zeroes should come through as zeroes, but Nulls can be much more tricky.  A true null should be addressable using the isnull() function in which case you can replace it with bonafide 'null' string values or '-' string values.  But maybe take a look at this treatise too. There are a lot of scenarios to account for any you may need to narrow what your solving for to create a sensible solution:

https://community.qlik.com/t5/Member-Articles/NULL-handling-in-QlikView/ta-p/1484472

BrunPierre
Partner - Master
Partner - Master

Try with a NullAsValue statement below for handling the Nulls, the zeroes should be represented as such.

NullAsValue *; //or specify in which fields

Set NullValue = '-'; // or replace the NULLs with preferred string/character

Data:
LOAD * FROM SourceTable;

Levi_Turner
Employee
Employee

To show the result of one of the techniques referenced by @JonnyPoole:

// Ensure that blanks are treated as Nulls
SET NullInterpret ='';
// Load initial table, this will be displayed in a default way by Qlik as a null value
[t1]:
LOAD * INLINE [
id,value
1,
2,1
3,3
];

// Define our field which want to be handled in a non-standard manner
NullAsValue [value2];
// Set our desired value for null
SET NullValue = '--';

// Load secondary table, id2's value2 field will be displayed as -- rather than the default manner of displaying nulls.
[t2]:
LOAD * INLINE [
id,value2
1,
2,1
3,3
];

which results in:

Levi_Turner_0-1712251026347.png