Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
SP_Qlik
Contributor II
Contributor II

Storing data into 4 different folders of 4 different clients which are coming from same QVD

Hi,

Hope you are doing well!

I have a QVD which consists of multiple clients data(Ex: 4 clients). Here my requirement is to store this QVD into multiple folders based on client name.

For Example: Client 1 data I have to store into Folder 1  and Client 2 data I have to store into Folder 2 and so on....

But I have to achieve this with single reload

, May be through loops we may achieve this.

Can any one suggest a way to achieve this?

Many Thanks in Advance!

Labels (1)
1 Solution

Accepted Solutions
SP_Qlik
Contributor II
Contributor II
Author

Hi,

Thank you so much for your post as its resolved my issue with little bit changes in script.

 

Thank You,

SP

 

View solution in original post

3 Replies
henrikalmen
Specialist
Specialist

With just four clients you could just repeat yourself four times. Something like this:

client1: load * from [qvdfile] (qvd) where CLIENT=1;

store client1 into [qlient1.qvd] (qvd);

drop table client1;

 

Do the same for each client. If you’ve got many clients you could first load distinct client from [qvdfile] into a table, and after that you do a for-loop that iterates over that table, extract the client (e.g. with peek() function) into a variable and use the value to load the correct client data from your qvd and store it where you want it. 

vinieme12
Champion III
Champion III

Sample script below

Replace ClientField to be exact field name that has the Client values

KeepClients:
Load * inline [
ClientList
C1
C2
C3
C4
];



for each clnt in fieldvaluelist('ClientList')

  Set vTableName = $(clnt) ;

  KeepClnt:
  Load '$(clnt)' as ClientField
  AutoGenerate 1;

  $(vTableName):
  Load * 
  From MainQvd.qvd(qvd)
  Where Exists(ClientField);
  
  Store $(vTableName)  into [lib://Somefolder/$(vTableName).qvd](qvd);
  Drop table $(vTableName);
  Drop table KeepClnt;
  
next clnt;

Drop table KeepClients;

exit Script;

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
SP_Qlik
Contributor II
Contributor II
Author

Hi,

Thank you so much for your post as its resolved my issue with little bit changes in script.

 

Thank You,

SP