Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Theo_Westseit
Contributor III
Contributor III

Load fields from two different tables

Hello Guys,

my current code loads two fields from one csv-file.

LOAD
    FIELD_A,
    FIELD_B

FROM [lib://DATA_Public/EXPORT_A.csv]
(txt, codepage is 28591, no labels, delimiter is ';', msq);

Main_Tab:
Load
FIELD_A,
FIELD_B
Resident Main_Tab_Temp
 Group by FIELD_A, FIELD_B;
Drop Table Main_Tab_Temp;


Now i want it to load these fields from two csv files ("EXPORT_A" and "EXPORT_B") instead of one.
The fields have the same names in both csv files.

How do i need to change the code?

1 Solution

Accepted Solutions
stevejoyce
Specialist II
Specialist II

If the tables have exactly same column names it will auto-concatenate/union.  But I always prefer to explicitly write concatenate like below.  Is below what you're looking for? 

You can also do this is you know the file structures are all the same with the wildcard search.

FROM [lib://DATA_Public/EXPORT_*.csv]

 

Main_Tab_Temp:
LOAD
FIELD_A,
FIELD_B

FROM [lib://DATA_Public/EXPORT_A.csv]
(txt, codepage is 28591, no labels, delimiter is ';', msq);

Concatenate(Main_Tab_Temp)
LOAD
FIELD_A,
FIELD_B

FROM [lib://DATA_Public/EXPORT_B.csv]
(txt, codepage is 28591, no labels, delimiter is ';', msq);

Main_Tab:
Load
FIELD_A,
FIELD_B
Resident Main_Tab_Temp
Group by FIELD_A, FIELD_B;
Drop Table Main_Tab_Temp;

View solution in original post

2 Replies
stevejoyce
Specialist II
Specialist II

If the tables have exactly same column names it will auto-concatenate/union.  But I always prefer to explicitly write concatenate like below.  Is below what you're looking for? 

You can also do this is you know the file structures are all the same with the wildcard search.

FROM [lib://DATA_Public/EXPORT_*.csv]

 

Main_Tab_Temp:
LOAD
FIELD_A,
FIELD_B

FROM [lib://DATA_Public/EXPORT_A.csv]
(txt, codepage is 28591, no labels, delimiter is ';', msq);

Concatenate(Main_Tab_Temp)
LOAD
FIELD_A,
FIELD_B

FROM [lib://DATA_Public/EXPORT_B.csv]
(txt, codepage is 28591, no labels, delimiter is ';', msq);

Main_Tab:
Load
FIELD_A,
FIELD_B
Resident Main_Tab_Temp
Group by FIELD_A, FIELD_B;
Drop Table Main_Tab_Temp;

Theo_Westseit
Contributor III
Contributor III
Author

Thanks!!