Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am attaching one sample file in that I have a channel column which contains the different different channels.
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.
"Thanks a ton"...Kush. It is now working fine.
welcome ![]()
welcome ![]()
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;
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
Kush...that's Great...
Thank You Very Much !!!
Welcome bro