Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
DamianoD
Contributor
Contributor

How to ignore load of QVD with 0 records

Hi All,

 

I'm stuck with a problem while loading qvd's in my app.

 

I've split a table QVD in more QVD's, divided by TableName_YYYYMM.qvd partition.

These files start from 202002, anyway i've set a condition in my app to take into consideration just TableName_*.qvd greater or equal than Month(Today) -36.

During these days, i've tried to reload my app and I saw that qlik script, obviously, still keep uploading every qvd part, even though, for example,
202002 part is being loaded with 0 records in it, since my where condition in the table script let me start from 202003.

Is there any method to save time ignoring the load of qvd's with 0 records?


The client asked this for an ODAG Implementation, since a filter of the ODAG is the exact date, so there will be a lot of qvd's part producing 0 records while loading them into the Template App.

 

Thanks,

Damiano

10 Replies
alexanderbrown254b
Contributor
Contributor

Thank you for bringing this to my attention. I apologize for the confusion. You are correct that the variable vQVD was not properly defined in my previous script. Here is the corrected script that should work with your QVD naming convention:

LET vMaxDate = Num(MonthStart(Today()) - 36, 'YYYYMM');

FOR each vQVD in FileList('lib://QVDs/Tablename_*.qvd')
   LET vQVDDate = Mid('$(vQVD)', Len('$(vQVD)') - 11, 6);
   IF vQVDDate >= vMaxDate AND EXISTS('$(vQVD)') THEN
      TableName:
      LOAD * FROM [$(vQVD)] (qvd);
   ENDIF
NEXT

This script should load all QVDs with filenames in the format "Tablename_YYYYMM.qvd" that are greater than or equal to the maximum date specified by vMaxDate and contain at least one record.

I hope this helps! Let me know if you have any further questions.