Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
mfcelleri
Contributor II
Contributor II

How to search a field in qvd file

Hi guys.

I have several qvd files, which differ in the number and name of fields.

But I need to upload all the files with all their fields.

Is there a way to know if a file has a field or not, so that during the loading process, it does not generate an error when reading a file that does not have those certain fields?

 

Thanks and regards.

Labels (3)
5 Replies
sbaro_bd
Creator III
Creator III

Hi @mfcelleri ,

If you want to load all fields from a QVD, use * in your LOAD statement like :  LOAD *  FROM [lib://path/qvd_name.qvd](qvd).

The star symbol will take all fields avaible in the qvd.

Regards.

 

mfcelleri
Contributor II
Contributor II
Author

Hi @sbaro_bd ; thanks for your reply.

That it's not what I want.

 

A short example: Table1 has field1, field2, field3; Table2 has field1, field2, field3, field4; both tables has the same info; but Table2 file's structure change since x's date.

Each qvd file is a cut of information on a specific day; so I have to process each file.

How to validate that in Table1 file (the example) it does not have the field field4; I wan't to prevent give me an error when processing the file.

Hope I explain much better.

pravinboniface
Creator III
Creator III

I'm not very clear with your requirements, but it sounds like you can come up with some logic using the functions QvdFieldName() and QVDNoOfFields().

Also, you can read 1 row from the QVD into a resident table and then use the FieldName() and NoOfFields() to achieve the same thing.

sbaro_bd
Creator III
Creator III

Hi @mfcelleri ,

Can you tell us what kind of error do you want avoid exactly when you load your QVD ? Please, provide an example with screenshot if possible (synthetic keys? field not found? wrong concatenation?)

Regards.

marcus_sommer

Like the others have already hinted you may query the meta-data of the qvd or doing a pre-load of one record. And the field-information could be extracted + checked + prepared (usually assigning the essential information to variables) and appropriate branched.

It's no big magic but it will need some extra steps. If I understood your description right it are always the same data - just a few fields are coming/going over the time respectively depending on different sources/channels and similar stuff. In this case you may shortcut the approach by loading the data with a field-wildcard and enforcing a concatenation of the loads, for example with:

t: load 'dummy' as Dummy autogenerate 1;

for each file in filelist('path/file*.qvd')
   concatenate(t) load * from [file] (qvd);
next

drop fields Dummy from t;