Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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.
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.
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.
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.
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;