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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
dmohanty
Partner - Specialist
Partner - Specialist

Concatenate uncommon QVDs from different folders

Hi Friends,

I have a scenario to concatenate the QVDs present in two folders and store them in a new folder. Both folders have some set of same QVDs with different structures. Those will be concatenated easily. No Problem. But the QVDs that are present in one folder but not in other folder and vice-versa, are not being stored in the destination folder. "Table Not Found" error arises. I really need to store these uncommon QVDs as well in the concatenated folder. How to deal with this scenario? Any IF...ELSE Condition required? Please revise the code below:

let qvdpath = 'C:\Users\XYZ\Desktop';

for each qvd_file in FileList('$(qvdpath)\MAP\*')

let QVDName = subfield('$(qvd_file)','\',6);

$(QVDName):

load

*

FROM

$(qvdpath)\MAP\$(QVDName)

(qvd);

next

for each qvd_file in FileList('$(qvdpath)\HPG\*')

let QVDName = subfield('$(qvd_file)','\',6);

Concatenate($(QVDName))

load

*

FROM

$(qvdpath)\HPG\$(QVDName)

(qvd);

store $(QVDName) into C:\Users\XYZ\Desktop\Test QVDs\$(QVDName);

drop Tables $(QVDName);

next

EXIT Script ;

13 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

I didn't realise that TableName() is zero based until I looked at your error.

Change the last part of the script:

For z = 0 to NoOfTables() - 1
          Let vTableName = TableName(z);
          Let vOutfile = vTableName & '.qvd';
          STORE [$(vTableName)] INTO [$(qvdpath)\Test QVDs\$(vOutfile)] (qvd);

          Drop Table [$(vTableName)];
Next

I think that should solve the problem.

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jonathandienst
Partner - Champion III
Partner - Champion III

Jason

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
dmohanty
Partner - Specialist
Partner - Specialist
Author

Hi Jonathan, got a solution. Thanks to Rob for that. Probably the DROP command was creating the problems.

Changed the script to  FOR i = NoOfTables()-1 to 0 step -1.

Working fine now. Thanks a lot for your help.

Regards.

dmohanty
Partner - Specialist
Partner - Specialist
Author

Hi Jonathan/Jason,

Can you please help me too in the post in this link?

http://community.qlik.com/message/303936#303936

Regards.