Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

loading QVD's in xml format within subfolders

I had a requirement in which I have to read the QVD's in folders and subfolers as XML format. Basically to find meta data information about the multiple QVD's.

As an example: -

with in C:\Applications\QVD\x1.QVD

, C:\Applications\QVD2\x2.QVD

C:\Applications\QVD3\x3.QVD

Now I want to get load all these QVD's in xml.

I have tried below code but it always give information about x3.QVD.

Set vConcatenate = ;

sub ScanFolder(Root)

          for each FileExtension in 'qvd'

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

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

                              QvdFields:

                              $(vConcatenate)

                              LOAD

                                 1                      as FieldCount,

          '$(vFileName)'         as [File Name],

          FieldName              as [Field Name],

          BitOffset              as [Bit Offset],

          BitWidth               as [Bit Width],

          Bias                   as [Bias],

          NoOfSymbols            as [No Of Symbols],

          [NumberFormat/Type]    as Type,

          [NumberFormat/nDec]    as Dec,

          [NumberFormat/UseThou] as UseThou,

                               '$(FoundFile)' as SourceFile

                              FROM [$(FoundFile)] (XmlSimple, Table is [QvdTableHeader/Fields/QvdFieldHeader]);;

                              Set vConcatenate = Concatenate;

                    next FoundFile

          next FileExtension

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

                    call ScanFolder(SubDirectory)

          next SubDirectory

end sub

Call ScanFolder('C:\Applications') ;

Please help

3 Replies
swuehl
MVP
MVP

Seems to work for me, your code scanned all QVD in my download folder.

Why do you think that only x3.QVD has been scanned? Have you checked the SourceFile field values?

You are using a wrong variable name here:

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


So maybe this is causing your issues.

Not applicable
Author

Hi swuehl,

Yes you are correct. I am using wrong variable.

I corrected it but the point is I want to load QVD's from every folder.

Example :-

C:\Applications\folder1\x1.QVD

C:\Applications\folder1\x4.QVD

C:\Applications\folder1\subfolder1\x5.QVD

, C:\Applications\folder2\x2.QVD

C:\Applications\folder3\x3.QVD

Now if I use below code it will only fetch x1 , x4 and x5 Qvd's but not x2 and x3 as they are iin different folders and are not subfolders of folder1.

How will I fetch x2 and x3 QVD.?

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:

                              $(vConcatenate)

                              LOAD

                                 1                      as FieldCount,

          '$(vFileName)'         as [File Name],

          FieldName              as [Field Name],

          BitOffset              as [Bit Offset],

          BitWidth               as [Bit Width],

          Bias                   as [Bias],

          NoOfSymbols            as [No Of Symbols],

          [NumberFormat/Type]    as Type,

          [NumberFormat/nDec]    as Dec,

          [NumberFormat/UseThou] as UseThou,

                               '$(FoundFile)' as SourceFile

                              FROM [$(FoundFile)] (XmlSimple, Table is [QvdTableHeader/Fields/QvdFieldHeader]);;

                              Set vConcatenate = Concatenate;

                    next FoundFile

          next FileExtension

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

                    call ScanFolder(SubDirectory)

          next SubDirectory

end sub

Call ScanFolder('F:\Practise Apps\Subfolder scaning\Main') ;

swuehl
MVP
MVP

Not sure what your issue is, it works at my side. Are you sure you are giving the right parent folder (parent of all subfolders you want to scan) in the initial ScanFolder call?

Call ScanFolder('F:\Practise Apps\Subfolder scaning\Main') ;