Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Welcome to our newly redesigned Qlik Community! Read our blog to learn about all the new updates: READ BLOG and REPORTED ISSUES
cancel
Showing results for 
Search instead for 
Did you mean: 
Creator II
Creator II

Concatenate issue for tables in the loop

Hi everyone. 

I have an issue with tables concatenation. I have a list of .qvds that looks like next one:

Z1:
Load * Inline [
A, B, C
3, 4, 5
];
Store Z1 into '$(vTargetPath)'Z1.qvd];
Drop Table Z1;

Z2:
Load * Inline [
A, B, C, D
3, 7, 10, 12
];

Store Z2 into '$(vTargetPath)'Z2.qvd];
Drop Table Z2;

I take all tables using For - Next loop.

For Each File in Filelist('$(vTargetPath)Z*.qvd')
TMP: 
Load *
From [$(File)](qvd);
Next File

 

And I need to have all the tables i load in one big TMP table. But instead of it I got TMP and TMP-1 tables for Z1 and Z2 qvds.  How do I may concatenate tables with different amount of fields inside the loop?

Labels (2)
1 Solution

Accepted Solutions
Master II
Master II

@Peony 

concatenation is not automatic since you do not have the same columns.

but you can always do that trick

TMP:
load * inline [
TmpField
];


For Each File in Filelist('$(vTargetPath)Z*.qvd')
TMP: 
concatenate(TMP)
Load *
From [$(File)](qvd);
Next File;

drop fields TmpField;

 

output :

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

2 Replies
Master II
Master II

@Peony 

concatenation is not automatic since you do not have the same columns.

but you can always do that trick

TMP:
load * inline [
TmpField
];


For Each File in Filelist('$(vTargetPath)Z*.qvd')
TMP: 
concatenate(TMP)
Load *
From [$(File)](qvd);
Next File;

drop fields TmpField;

 

output :

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

Creator II
Creator II

@Taoufiq_Zarra  Thank you very much for your help. This solution is perfect.