Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Guys,
I want to load data from specific log files(*system*) from multiple specific folders like Folder 1, Folder 4, Folder 6. Could you please tell me the efficient/best way?
For e.g.
Load *
from Path\Folder N/*system*.log
(txt, utf8, embedded labels, delimiter is '\t', msq);
Thanks,
Sagar
you can use the for next loop:
For..next ‒ QlikView
For vCounter = 1 to 5
Load *
from Path\Folder $(vCounter)/*system*.log
(txt, utf8, embedded labels, delimiter is '\t', msq);
Next
How to make vcounter = 1 to 5 static to dynamic?
what is your business rule to determine N in your original code? if the folders are finite then its a finite number. if not then you need a different approach. so it depends you need to define that so others can advise you
if you dont know the number of subfolders then you will need a nested loop:
List folders within a directory - Qlik Community - 88811
your outer loop will give you the folder name so you don't need to use folder$(vcount). you will have a variable that stores the folder name so use that in your inner loop
For each vSubDir in dirlist( 'D:\Backup\*' )
for each vFile in [$(vSubDir)\*system*.log]
Load *
from [$(vSubDir)\$(File)]
(txt, utf8, embedded labels, delimiter is '\t', msq);
next vFile
Next vSubDir
//you just need to experiment with this part:
// from [$(vSubDir)\$(File)]
//you will see this in your log
Folder numbers are not sequential. It’s like Folder 1, 4 and 6.
can I maintain one inline table of required folders name only? So it will be easier to maintain.
you can conrol which folder to be processed in the phrase
in dirlist( 'D:\Backup\*' )
you can use relative paths
Can you please tell me how to pick up certain folders?
use your pattern:
'c:\path\folder *'
from your sample this is what you were using so just use that in the directory list function