Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Consider I have multiple .qvd files at one folder and no app is created in Qlik Sense desktop.
So, How can I load multiple .qvd files into my data load editor at once (using script), so that I can see metadata of the multiple .qvd files. (Manually adding .qvd files is not preferred)
Hi,
Please find the script below. Please make sure when you copy the code, the indentions are perfectly matched. Here, first files are listed from a directory, and storing the file names in the variables, and then doing loop to load the files.
---------------------------------------------
sub ScanFolder(Root)
for each FileExtension in '*'
for each FoundFile in filelist( Root & '\*.' & FileExtension)
FileList:
LOAD '$(FoundFile)' as FilePath,
SubField(SubField('$(FoundFile)','.',-2),'/',-1) as FileName
AUTOGENERATE 1;
next FoundFile
next FileExtension
for each SubDirectory in dirlist( Root & '\*' )
call ScanFolder(SubDirectory)
next SubDirectory
end sub
Call ScanFolder('lib://ConnectionName/Folder_From_Files_To_Load/') ;
FileDetails:
LOAD * INLINE
[
1
];
LET vRecordNumber = NoOfRows('FileList');
TRACE 'Number of Records = $(vRecordNumber)';
FOR RecordNumber=1 TO NoOfRows('FileList')
LET vFileToLoadName = PEEK('FileName',RecordNumber-1,'FileList');
TRACE 'File Name to Load = $(vFileToLoadName)';
CONCATENATE(FileDetails)
LOAD
QvBuildNo,
CreatorDoc,
CreateUtcTime,
SourceFileSize,
"TableName",
RecordByteSize,
NoOfRecords,
Offset,
"Length",
%Key_QvdTableHeader_B94FCCAC68ED3E20
FROM [lib://ConnectionName/Folder_From_Files_To_Load/$(vFileToLoadName).qvd]
(XmlSimple, table is QvdTableHeader);
NEXT
DROP Field "1";
Exit Script;