Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
dandaanilreddy
Partner - Creator III
Partner - Creator III

How to pick a specific field name from qvds from sub folders

Hello All,

Is there a way i can pull a specific field name from the qvds and the qvd paths from different folders and store it in a qvd.

E.G: i have 40 qvds in which 35 qvds have a field called Status. I want to create a qvd which contains information about the fieldname, qvdname and qvdpath.

Expected output:

FieldNameQvdnamePath
Statusapplelib: //abc/123/
Statusballlib://efg/abc/
1 Solution

Accepted Solutions
Kushal_Chawda

you may need to read the QVD's xml headers to get the information.

1) call DoDir ('lib://Data'); //Mention correct path here where you have all QVD folders in below code .

2) where lower(trim("FieldName")) like '*status*'; // If you want the fields name just as status then no need to mention wildcard ,you can simply use 'status'  in below code

sub DoDir (Root)

   for each Ext in 'qvd'

      for each FoundFile in filelist (Root&'/*.' &Ext)

         FileList:
         LOAD
        mid('$(FoundFile)',1,index('$(FoundFile)','/',-1)) as FilePath,
        SubField('$(FoundFile)','/',-1) as QvDName,
        "FieldName"
         FROM [$(FoundFile)]
        (XmlSimple, table is [QvdTableHeader/Fields/QvdFieldHeader]);

      next FoundFile

   next Ext

   for each Dir in dirlist (Root&'/*' )

      call DoDir (Dir)

   next Dir

end sub

call DoDir ('lib://Data');

Fields:
NoConcatenate
Load *
Resident FileList
where lower(trim("FieldName")) like '*status*';

Drop Table FileList;

View solution in original post

4 Replies
SerhanKaraer
Creator III
Creator III

Hello Dandaanilreddy,

I guess this is not what you need, but maybe a qvd viewer solves your problem.

An application of a qvd viewer is served by @rwunderlich at his blog:

https://qlikviewcookbook.com/2020/06/qviewer-version-4-is-here/

Kushal_Chawda

you may need to read the QVD's xml headers to get the information.

1) call DoDir ('lib://Data'); //Mention correct path here where you have all QVD folders in below code .

2) where lower(trim("FieldName")) like '*status*'; // If you want the fields name just as status then no need to mention wildcard ,you can simply use 'status'  in below code

sub DoDir (Root)

   for each Ext in 'qvd'

      for each FoundFile in filelist (Root&'/*.' &Ext)

         FileList:
         LOAD
        mid('$(FoundFile)',1,index('$(FoundFile)','/',-1)) as FilePath,
        SubField('$(FoundFile)','/',-1) as QvDName,
        "FieldName"
         FROM [$(FoundFile)]
        (XmlSimple, table is [QvdTableHeader/Fields/QvdFieldHeader]);

      next FoundFile

   next Ext

   for each Dir in dirlist (Root&'/*' )

      call DoDir (Dir)

   next Dir

end sub

call DoDir ('lib://Data');

Fields:
NoConcatenate
Load *
Resident FileList
where lower(trim("FieldName")) like '*status*';

Drop Table FileList;

dandaanilreddy
Partner - Creator III
Partner - Creator III
Author

It Worked. Thanks a lot. 🙂 🙂

Kushal_Chawda

Glad that it worked..Cheers!!