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

What is NullAsValue and NullAsNull ??

Hey,

Can any one tell me what is :

NullAsValue and NullAsNull ??

And also the difference between them ??

I read reference manual also but didn't understand anything.

Thanks.

8 Replies
its_anandrjs

Hi,

From QV Help it will well explained

NullAsValue

The NullAsValue statement specifies for which fields the encountered NULLs should be converted to values.

By default, QlikView considers NULL values to be missing or undefined entities. However, certain database contexts imply that NULL values are to be considered as special values rather than simply missing values. The fact that NULL values are normally not allowed to link to other NULL values can be suspended by means of the NullAsValue statement.

The NullAsValue statement operates as a switch and will operate on subsequent loading statements. It can be switched off again by means of the NullAsNull statement.

The NullAsValue can be combined with the variable NullValue that specifies which string to use as NULL value. If the variable NullValue is not used, NullAsValue will replace NULLs with empty strings.

The syntax is:

NullAsValue*fieldlist

*fieldlist is a comma separated list of the fields for which NullAsValue should be turned on. Using * as field list indicates all fields. The wildcard characters * and ? are allowed in field names. Quoting of field names may be necessary when wildcards are used.

Example:

NullAsValue A,B;

Set NullValue = 'NULL' ;

Load A,B from x.csv;

NullAsNull

The NullAsNull statement turns off the conversion of NULLs to string values previously set by a NullAsValue statement.

The NullAsValue statement operates as a switch and can be turned on or off several times in the script, using either a NullAsValue or a NullAsNull statement.

The syntax is:

NullAsNull *fieldlist

*fieldlist is a comma separated list of the fields for which NullAsValue should be turned off. Using * as field list indicates all fields. The wildcard characters * and ? are allowed in field names. Quoting of field names may be necessary when wildcards are used.

Examples:

NullAsNull A,B;

Load A,B from x.csv;

Regards

Anand

nikhilgarg
Specialist II
Specialist II
Author

Hey,

Do you mean to say that by NulAsValue the field for which it is set Null will treat it a value. And the fields for which NullAsNull is set will not treat the Null value if a field as value ??

Is it so ??

SergeyMak
Partner Ambassador
Partner Ambassador

Hi Nikhil,

If you set

NullAsValue you can select just empty value in the table or in the listbox,

But if you set NullAsNull you will not see empty value in the listbox, you will see '-' sign in the table and you will not be able to select it.

Regards,

Sergey

Regards,
Sergey
SergeyMak
Partner Ambassador
Partner Ambassador

PFA an application. Probably It will make clearer the difference.

The fields B and NullAsValue loaded as NullAsValue;

The fields A and NullAsNull loaded as NullAsNull;

Regards,
Sergey
nikhilgarg
Specialist II
Specialist II
Author

Hey,

You mean to say that let say we have 2 columns A and B.

If some values in column A is Null or Empty then ,

If i use: 

NullAsValue A,B;

Set NullValue = 'NULL' ;

Load A,B from x.csv;

then , empty or null values will be presented as Null.

If i use NullAsNull then , the values which are empty or null will be shown by '-'

Is it so ???  Please clarify.

Thanks

nikhilgarg
Specialist II
Specialist II
Author

Hey,

I am using personal version of Qlikview so cannot open your attachement. Can you please tell me here.

Thanks

SergeyMak
Partner Ambassador
Partner Ambassador

Put it into Load script and reload the app

NULLASNULL NullAsNull;
NULLASVALUE NullAsValue, B;

Data:
LOAD *,
Null() AS NullAsValue,
Null() AS NullAsNull

 
INLINE [
A, B
A,B
];

Concatenate(Data)
LOAD
'A'
AS NullAsValue,
'A'
AS NullAsNull
Resident Data;

 

Then, add listboxes of al fields and tableaux with all the fields.

You will see the result


Regards,

Sergey

Regards,
Sergey
Brett_Bleess
Former Employee
Former Employee

Nikhil,

Try the following two links, they may help, and there is also a technical brief attached to them that may also provide further information that may help here.

http://community.qlik.com/blogs/qlikviewdesignblog/2013/05/02/finding-null

http://community.qlik.com/blogs/qlikviewdesignblog/2013/04/30/null-the-invisible-nothing

Hope this helps you get a better grasp on things.

Regards,

Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.