Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

how to save data in CSV with a condition

Hi Team,

I'm working in Qliksense and generated some flags based on some conditions. 

I want to store the data in a local folder. 

I'm able to store entire table STORE Sample INTO lib://Test/Check_1_Test_Export.csv (txt);

however I have a column like below which has "WithDecimal" or "WithoutDecimal" and I want to store/save into CVS or XLSX where Check_1_Flag is 'WithoutDecimal'?

Dec.png

how to save only WithoutDecimal in CSV?

1 Solution

Accepted Solutions
Highlighted
Creator
Creator

Hi @harsha  I believe that you have two problems.

First your flag, doesn't  work well, when I was checking your table, you have flag for data that not is decimal number.

Try something like this: if( isnull(even(Value), 'WithoutDecimal','Decimal') as _falg

And aditional, when you store use the code that @Kush  give you to store, that can will solve your dude.

I quote you @Kush:

Sample:

load *

FROM source

where  _Flag='WithoutDecimal';

STORE Sample INTO lib://Test/Check_1_Test_Export.csv (txt);

 

If you need store twice, use a for for your field, something like this:

for each _flag in fieldvaluelist(_flag)

dataTmp:

Load * resident  sample where _flag = '$(_flag)';

STORE dataTmp INTO lib://Test/Check_1_Test_Export_($_flag).csv (txt);

drop t able dataTmp;

next  _flag;

regards!

View solution in original post

11 Replies
Highlighted
Specialist II
Specialist II

Hi 

Change your delimiter 

eg : 

store TEMP into [lib://Documents/TEMP.csv ](txt, delimiter is ';')

Highlighted
MVP
MVP

Can't you put where condition  and then store it?

Sample:

load *

FROM source

where  Check_1_Flag='WithoutDecimal';

STORE Sample INTO lib://Test/Check_1_Test_Export.csv (txt);

Highlighted
Creator
Creator

I did however it saves me all 

Highlighted
Creator
Creator

Hi Bruno,

 

Thanks for the quick response... but my expectation is something diff.

I want to save only when one particular dimension meets a validation.

Ex: store when Year = 2019 

 

something like above

Highlighted
MVP
MVP

Would you be able to share sample?

Highlighted
Creator
Creator

Hi,

I have the below output saved but I want to save only 'withdecimal' results from 'Check_1_Flag' (column/dimension) 

This (STORE Check2 INTO lib://Test/Check_1_Flag.csv (txt);) saves both 'WithDecimal' and 'WithoutDecimal' but how can I save only the 'WithDecimal'?

Dec.png

Highlighted
MVP
MVP

From where data is coming?

did you try as I mentioned with where filter condition?

Highlighted
Creator
Creator

Data is coming from an excel

yeah.. i tried...

but it was saving all.

Highlighted
MVP
MVP

Would you be able to share sample excel file?