Loading with wildcard file and preceding load failing autoconcatenate
So basically, like the title says, I'm having multiple files loaded with a wildcard in the FROM statement. All files start with 'Leveringsbonnen' and they are loaded through a FROM statement as follows "Leveringsbonnen*"
The preceding load was done as follows (the commented code):
// Best.Bon & '|' & Code AS CatKey
"Waarde in EUR",
Num(Gem.Prijs) AS Gem.Prijs,
Replace(FileBaseName(),'Leveringsbonnen','') AS Code
(txt, codepage is 28591, embedded labels, delimiter is ';', msq);
Problem is, for one of the 7 files, it doesn't do the preceding load, which in turns prevents the autoconcatenate.
Anyone has any idea how this is possible? Thanks in advance.
I think without any other error-message your aproach should work. This means I assume that there is any other error like a missing field, a different file-format or something similar. Your datamodel will show this extra table so that you could look on the file if there is anything unexpected.
Beside this it's often better to use a loop with filelist() instead of applying the wildcard directly into the load-path. By such an approach you could enforce a concatenating even by not identically datastructures and also applying a lot of further checkings: Loops-in-the-Script.
That's the strange thing, it doesn't throw any errors, all fields are the same, but for that 1 table (out of the 7), it doesn't execute the preceding load.
I'm using the exact same load structure (preceding + wildcard in FROM) for another set of 7 tables and again, it loads all tables perfectly, except one where the preceding load isn't executed. Both times it's the 2nd file down the list where something goes wrong.
For now I've been able to solve my problem through a resident load (the first load was a Temp table, so the resident had to happen anyway), but I'll look into the loop with filelist to see if the same issue occurs.
I have experienced similar problem several times. Loading multiple tables with wildcard and preceding load results in all tables being loaded but the preceding load only applied on the first one.
I did a lot of research on this and it turned out I was not the only one with this issue. Apparently there is a problem with the preceding load when multiple files are loaded with wildcard. I guess this is a Qlik bug. And yes, the script does load without an error.
You can either load all tables separately with preceding load and without wildcard (not very elegant) or first load all files in a temp table using wildcard and then use that as a resident table (what I usually do). Loop, as Marcus suggested, should also work.