Skip to main content
Announcements
Product Release Webinar: Qlik Insider airing December 6! REGISTER TODAY!
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

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".

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

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".
marcus_sommer
MVP & Luminary
MVP & Luminary

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.