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: 
Not applicable

For each loop while add load

Hi everybody

I have studied the related topics to my Theme, but still don't have a clear answer for my question. Is it possible to make the for each loop work, if you have add load?

I have something like this:

let var = file1, file2, file3

for each file in $(var)

tabletemp:

add load *

FROM $(var);

...

Wish you a nice day!

2 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

This will be concatenated to the same table automatically by a QlikView phenomenon called ... AutoConcatenate. When the next LOAD detects a similar table layout as the last one, the new data will be concatenated to the resident table.

BTW to make it work, drop the add keyword, change FROM $(var) into FROM $(file) and add a NEXT keyword to the end

However, there may be situations where this trick refuses to work (I got a couple of cases that were very RAM-dependent, and some may have been hampered by other things in QlikView not working altogether well)). To make sure that it works under all circumstanctes, you can force concatenation by using a $-sign expansion variable, like in:

LET var = 'file1', 'file2', 'file3'

LET vPrefix = 'tabletemp:';

FOR EACH file IN $(var)

  $(vPrefix)

  LOAD *

  FROM $(var);

  LET vPrefix = 'CONCATENATE (tabletemp)';

NEXT

The syntax checker will go crazy on the free variable. Don't worry, it'll still work out ok.

Peter

Not applicable
Author

thank you for the answer, Peter!   sorry for mistakes... I thought that when we use partial reload, we need to add ADD before loading -> add load, otherwise it won't work? My problem is that when I use partial reload, only first document from $(var) is opened but not the other two...