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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
lakshmanvepuri
Creator
Creator

Crosstable saving the file to csv missing Null Values.

HI All,

 

My Scenario to show all the data ( including null values ) while saving / exporting to csv File.

I have multiple columns and rows .. its a a sample mentioned here.

Input file data: 

CountryStateDef ValueUser Value
INDIAAP 5555
USOH1000 
INDIA 222288888

 

OutPut should be :

CountryStateDATATYPECONSTANT
INDIAAPDef Value0
INDIAAPUser Value5555
USOHDef Value1000
USOHUser Value0
INDIA Def Value2222
INDIA User Value88888

 

But I am getting the RESULT as:

CountryStateDATATYPECONSTANT
INDIAAPUser Value5555
INDIA Def Value2222
INDIA User Value88888
USOHDef Value1000

 

Enclosed the input File and also qvw file.

Labels (2)
2 Solutions

Accepted Solutions
MayilVahanan

Hi Lakshman,

Try like below

CrossTable(DATATYPE, CONSTANT, 2)
LOAD Country,
State,
if(Len(Trim([Def Value]))=0,0,[Def Value]) as [Def Value],
if(Len(Trim([User Value]))=0,0,[User Value]) as [User Value]
FROM
[Data.xlsx]
(ooxml, embedded labels, table is Sheet1);

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

lironbaram
Partner - Master III
Partner - Master III

hi 

this will work 

NullAsValue *;

Set NullValue = 0;


DetailTemp:
LOAD Country,
State,
[Def Value],
[User Value]
FROM
[Data.xlsx]
(ooxml, embedded labels, table is Sheet1);


Detail:
CrossTable(DATATYPE, CONSTANT, 2)
load *
resident DetailTemp;

drop Table DetailTemp;

STORE Detail INTO [DETAIL.csv] ( txt, delimiter is ',');

View solution in original post

3 Replies
MayilVahanan

Hi Lakshman,

Try like below

CrossTable(DATATYPE, CONSTANT, 2)
LOAD Country,
State,
if(Len(Trim([Def Value]))=0,0,[Def Value]) as [Def Value],
if(Len(Trim([User Value]))=0,0,[User Value]) as [User Value]
FROM
[Data.xlsx]
(ooxml, embedded labels, table is Sheet1);

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
lironbaram
Partner - Master III
Partner - Master III

hi 

this will work 

NullAsValue *;

Set NullValue = 0;


DetailTemp:
LOAD Country,
State,
[Def Value],
[User Value]
FROM
[Data.xlsx]
(ooxml, embedded labels, table is Sheet1);


Detail:
CrossTable(DATATYPE, CONSTANT, 2)
load *
resident DetailTemp;

drop Table DetailTemp;

STORE Detail INTO [DETAIL.csv] ( txt, delimiter is ',');

lakshmanvepuri
Creator
Creator
Author

Thank You very much @MayilVahanan  and @lironbaram ... Both the Solutions are working...