Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello
I have a list of filenames as a column in a qvd file. How can use them for importing data in a loop such as
FOR Each File in FileList ()
Thanks
Hello Yuriy,
FileNamesTable:
LOAD
Concat(Chr(39)&filenames&Chr(39), ', ') as filenames
FROM ....
LET vFileNames = Peek('filenames', 0, 'FileNamesTable');
DROP TABLE FileNamesTable;
FOR Each vFile IN $(vFileNames)
$(vFile):
LOAD *
FROM $(vFile);
NEXT vFile;
Best regards,
David
Hello Yuriy,
FileNamesTable:
LOAD
Concat(Chr(39)&filenames&Chr(39), ', ') as filenames
FROM ....
LET vFileNames = Peek('filenames', 0, 'FileNamesTable');
DROP TABLE FileNamesTable;
FOR Each vFile IN $(vFileNames)
$(vFile):
LOAD *
FROM $(vFile);
NEXT vFile;
Best regards,
David
Hello David
Could you please explain what Peek function does here.
LET vFileNames = Peek('filenames', 0, 'FileNamesTable');
Currently in variables overview vFileNames is empty
here (second example) a possible answer
http://community.qlik.com/blogs/qlikviewdesignblog/2013/09/02/loops-in-the-script
For using
FileNamesTable:
LOAD
Concat(Chr(39)&filenames&Chr(39), ', ') as filenames
FROM ....
you should get a table named 'FileNamesTable' with only 1 row containing values field 'filenames' concatenated like 'Field1', 'Field2', 'Field...'
peek function gets the value of this row and put it into vFileNames variable.
Because, you have 2 identical tables, QlikView auto-concatenate them and that's the reason your peek function doesn't work.
Here, I attached an example.
Best regards,
David
u will excatly get what u want only specify the ur path location in the path location path
For each file in Filelist( 'pathLocation\*.qvd')
Load *,
'$(file)' as FileName,
Floor( FileSize('$(file)')/1024) as FileSize,
SubField( '$(file)','\',-1) as FileType
From [$(file)];
Next file
Yes, but sometimes you want to load a list of SQL table names to extract data in a loop. For dimension tables for instance.
David