Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
bhavvibudagam
Creator II
Creator II

How to convert - to null

Hi Experts,

Can anyone please help me on this.

I have the exported output file from qlikscript like below. Here I need to convert    ( - ) to Null.


I have tried like this in the script

if(IsNull(trim([AB Targe])),Null(),trim([AB Targe)) as AB Targe,


But getting the dash(-) in the result still now. Please help me how to convert to null.Please find the sample source file.

Output screenshot.png

Thanks in advance.

1 Solution

Accepted Solutions
devarasu07
Master II
Master II

Hi,

may be this?

Fact:

load *,if(len([AD Target])<=0 or [AD Target]='-' or isnull([AD Target]),'Null',[AD Target]) as [AD Target Revised],

if(len([CD Target])<=0 or [CD Target]='-' or isnull([CD Target]),'Null',[CD Target]) as [CD Target Revised];

LOAD * INLINE [

    ID, AD Target, CD Target

    1, 67, 2

    2, 0, 0

    3, -, -

    4, -, 2

    5, 55, -

];

Capture.JPG

View solution in original post

4 Replies
Anil_Babu_Samineni

What are you getting when you use this?

if(IsNull([AB Targe]),'Null',trim([AB Targe)) as AB Targe

OR

if(Len([AB Targe]) = 0,'Null',trim([AB Targe)) as AB Targe,

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
devarasu07
Master II
Master II

Hi,

may be this?

Fact:

load *,if(len([AD Target])<=0 or [AD Target]='-' or isnull([AD Target]),'Null',[AD Target]) as [AD Target Revised],

if(len([CD Target])<=0 or [CD Target]='-' or isnull([CD Target]),'Null',[CD Target]) as [CD Target Revised];

LOAD * INLINE [

    ID, AD Target, CD Target

    1, 67, 2

    2, 0, 0

    3, -, -

    4, -, 2

    5, 55, -

];

Capture.JPG

devarasu07
Master II
Master II

Hi,

If your issue still not resolved, try to share the expected output and then check article as well,

NULL handling in QlikView

If u wish to handle "-" as "Null" in qlik front end then easily u can do it by enable check box in your pivot/table chart object--> presentation tabl  misisng symbol "-" into Null or NA like that

Capture.JPG

its_anandrjs
Champion III
Champion III

There are many threads on Qlik Community with the help of this you can get the knowledge about how to handle null values in the Qlikview.

https://community.qlik.com/docs/DOC-3155

http://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/null-value-handling.htm

how to handle null values in qlikview