Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
ShashiKumarV
Contributor
Contributor

How to fetch QVD Metadata from Multiple Sub folders and Multiple Towers

Hello,

We have 3 towers, which contains QVD folders and Sub folders within QVD folders.

I am able to fetch metadata of QVD's using the below script for one tower, however i need to write a script which will loop through all 3 towers of QVD and its Sub folders. Note: xxxxxx will remain same for all the 3 towers.

Example : Tower one :  \\xxxxxx\AAA\QVD\

                      Tower two :  \\xxxxxx\BBB\QVD\

                       Tower three : \\xxxxxx\CCC\QVD\

Script:

 

Set vConcatenate = ;

sub ScanFolder(Root)

for each FileExtension in 'qvd'

for each FoundFile in filelist( Root & '\*.' & FileExtension)

let vFileName = mid(FoundFile, index(FoundFile, '\', -1) + 1, 99);

 


QvdFields:

LOAD
'$(vFileName)' as QVD_Name,
FieldName as Column_Name,
'$(FoundFile)' as SourceFile
FROM [$(FoundFile)] (XmlSimple, Table is [QvdTableHeader/Fields/QvdFieldHeader]);

QvdTableHeader:

LOAD
CreatorDoc as QVW_Path,
mid(CreatorDoc, index(CreatorDoc, '\', -1) + 1, 99) as QVW_Name,
Date(CreateUtcTime, 'DD/MM/YYYY') as Created_Date,
Year(CreateUtcTime) as Year,
Month(CreateUtcTime) as Month,
Day(CreateUtcTime) as Day,
TableName as Table_Name,
'$(FoundFile)' as SourceFile
FROM [$(FoundFile)] (XmlSimple, Table is [QvdTableHeader]);

 

 

Set vConcatenate = Concatenate;

next FoundFile

next FileExtension

for each SubDirectory in dirlist( Root & '\*' )

call ScanFolder(SubDirectory)

next SubDirectory

end sub

 

Call ScanFolder('\\xxxxxx\AAA\QVD\') ;

 

 

Labels (1)
1 Reply
Brett_Bleess
Former Employee
Former Employee

Not sure if this will be of help or not, but it is along the lines of what you are doing, so hopefully it will, post from the Design Blog area:

https://community.qlik.com/t5/Qlik-Design-Blog/Loops-in-the-Script/ba-p/1473543

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.