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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
pra_kale
Creator III
Creator III

STORE function help Require

Hi,

I am attaching one sample file in that I have a channel column which contains the different different channels.

  1. I want to know how i can save files for different channels in .csv format. Means Banka.csv,  Agency.csv...etc.
  2. How i can save data in Three parts..means Records 1 To 5 in one file...From 6 To 10 in second file and 11 To 15 in one file.

By below given way I can save entire file into .csv format.

A:

LOAD Policy_no,

     Premium,

     Year,

     Month,

     Channel

   

FROM

(ooxml, embedded labels, table is Sheet1);

STORE A into E:\Qlikview\Sample_1.csv (txt);

But I don't know how to divide files based on condition in a script. Require help to resolve the issue.

Thanks in advance.

16 Replies
pra_kale
Creator III
Creator III
Author

"Thanks a ton"...Kush. It is now working fine.

Kushal_Chawda

welcome

Kushal_Chawda

welcome

pra_kale
Creator III
Creator III
Author

Hi Kush,

Just want to ask one more thing related to this..

If I want to add one more filter condition into this means with Channel if  I want Year also, then how I can achieve this.

For e.g. I want, file to be get saved for 1 for Banka channel for Year 2010 and another file for Banka channel but for 2011 Year. In above script where I should make the changes.

What I did is, I concatenated Year and Channel columns and created a Key and that Key I have replaced with (VChannel) but this method is not working...it is giving error 'unknown statement 2010Agency'

A:

LOAD Policy_no,

     Premium,

     Year,

     Month,

     Channel,

     Year&Channel as Key

   

FROM

(ooxml, embedded labels, table is Sheet1);

B:

LOAD distinct Key

  

Resident A;

for i=1 to fieldvaluecount('Key');

let vKey = fieldvalue('Key',$(i));

$(vKey):

NoConcatenate

LOAD Policy_no,

     Premium,

     Year,

     Month,

     Channel,

     '$(vKey)' as Key

  

Resident A

where Channel= '$(vKey)' ;

STORE $(vKey) into E:\Qlikview\$(vKey).csv (txt);

Drop Table $(vKey);

NEXT

Drop Table B;

Kushal_Chawda

create the another inner loop to achieve the same. see the below code

A:

LOAD Policy_no,

     Premium,

     Year,

     Month,

     Channel

FROM

(ooxml, embedded labels, table is Sheet1);

for i=1 to FieldValueCount('Channel')

let vChannel = FieldValue('Channel',$(i));

New:

NoConcatenate

LOAD '$(vChannel)' as Channel,

     Policy_no,

     Premium,

     Year as YEAR,

     Month

Resident A

where Channel='$(vChannel)';

for j=1 to FieldValueCount('YEAR')

let vYear = FieldValue('YEAR',$(j));

Final:

NoConcatenate

LOAD *

Resident New

where YEAR='$(vYear)';

STORE Final into E:\Qlikview\$(vChannel)_$(vYear).csv (txt);

DROP Table Final;

NEXT j

DROP Table New;

NEXT i

pra_kale
Creator III
Creator III
Author

Kush...that's Great...

Thank You Very Much !!!

Kushal_Chawda

Welcome bro