Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

rxp03570
New Contributor III

Replacing Blank values with Null()

Hi All,

I have a requirement where I have to replace blanks in the existing field values which has blanks with Null
(). For this requirement I'm using  if( len(trim(CORP))=0, null(), CORP).

The above requirement works with single field, but I have to do the same thing for all the fields available in the data set. Can anyone help me how to replace blanks for the entire dataset's available across all fields with Null().

Thanks

Rahul

1 Solution

Accepted Solutions
satishkurra
Valued Contributor II

Re: Replacing Blank values with Null()

What you can do is to convert NULL value in the script

This code has to be before MyTable1:

Map_Nulls:
Mapping LOAD
NULL(),
‘<Unknown>’
AutoGenerate 1;

And this after MyTable1:

MAP FieldName, * using Map_Nulls;

2 Replies
vishsaggi
Esteemed Contributor III

Re: Replacing Blank values with Null()

You can use NullASValue like in Qlik. Try below in your script.

NullAsValue *;

OR

NullAsValue Field1, Field2, ...;

SET NullValue = 'Null';

LOAD *

FROM .....;

satishkurra
Valued Contributor II

Re: Replacing Blank values with Null()

What you can do is to convert NULL value in the script

This code has to be before MyTable1:

Map_Nulls:
Mapping LOAD
NULL(),
‘<Unknown>’
AutoGenerate 1;

And this after MyTable1:

MAP FieldName, * using Map_Nulls;