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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
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.