Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Load xls files loop with Left Join

Hi everybody, 

I'm loading multiple files that I concatenate with the following script :

For Each nomfic in 'Fica', 'Ficb', , 'Ficc'

result:

Load A,B, C, D from $(nomfic);

LEFT JOIN (result)

LOAD A,E from $(nomfic);

next


It works perfectly without the LEFT JOIN.

I don't know how to make it work with LEFT JOIN so that the files concatenate ?

Each file has to be left joined and then concatenate.

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this.

For Each nomfic in 'Fica', 'Ficb', , 'Ficc'

Temp:

Load A,B, C, D from $(nomfic);

LEFT JOIN (Temp)

LOAD A,E from $(nomfic);

Result:

Load *,'$(nomfic)' as Source

Resident Temp;


Drop table Temp;

next

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

4 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this.

For Each nomfic in 'Fica', 'Ficb', , 'Ficc'

Temp:

Load A,B, C, D from $(nomfic);

LEFT JOIN (Temp)

LOAD A,E from $(nomfic);

Result:

Load *,'$(nomfic)' as Source

Resident Temp;


Drop table Temp;

next

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
marcus_sommer

You need in each case an additional step maybe the following:

For Each nomfic in 'Fica', 'Ficb', , 'Ficc'

     result:

     Load A,B, C, D from $(nomfic);

          LEFT JOIN (result)

     LOAD A,E from $(nomfic);

     store result into result_$(nomfic).qvd (qvd);

     drop tables result;

next

result: load * from result_*.qvd (qvd);

- Marcus

Anonymous
Not applicable
Author

Thanks Marcus,

The Kaushik solution seems perfect. I prefer to avoid generating intermediate qvds.

Anonymous
Not applicable
Author

Thanks Kaushik for this nice solution.