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: 
Not applicable

QVD and Incremental Load

Hi There,

I have created the script below to create a QVD from daily extracts and the do Incremental load from the new data. When I run the script nothing happens. Is there something that I am doing wrong? See script below, attached file with the naming convension and advise?

SavedLastFile = $(LastFile);

StartPeriod = 20131231235959;

sub DoDir (Root)

Set Delim = '_';

       for each Ext in '.csv'

      

              for each File in filelist (Root & '\OnlineTillDailyReport*' & Ext)

                           

                     Set FilePathName = $(File);

                     //FileDateTime = num(replace(replace(subfield(FilePathName, Delim, 2),'_',''),Ext,''));

                     FileDateTime = num(replace(replace(replace(subfield(FilePathName, Delim, 2),'_',''),' ',''),Ext,''));

                     if FileDateTime > LastFile and FileDateTime > StartPeriod then

                           OnlineTill:

                            LOAD //Date(Date#(Shift_Date,'m/d/yyyy h:mm'),'m/d/yyyy') as Date,

      Date(Shift_Date,'YYYY-MM-DD') as Date_OTILL,

      User_Details,

      Shift_ID,

      //User_Home_Depot,

      LEFT(User_Home_Depot,8) & '_' & Date(Shift_Date,'YYYY-MM-DD') as OTILL_JOINKEY,

      BD_Number,

      Transaction_Count,

      Credit_Card,

      Cash,

      Cheque,

      Total_Amount

  FROM

  [$(File)]

  (txt, utf8, embedded labels, delimiter is ',', msq);

     

                           LastFile = FileDateTime;

                     end if

             

              next File

             

       next Ext

      

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

       //call DoDir (Dir)

       //next Dir

      

end sub

call DoDir ('\\03rnb-qlkvw01\QVData\Kiosk\OnlineTill')

//Append OnlineTill_Master on to NewData

if $(SavedLastFile) > 0 and LastFile > SavedLastFile then

                           OnlineTill:

                            LOAD //Date(Date#(Shift_Date,'m/d/yyyy h:mm'),'m/d/yyyy') as Date,

      Date(Shift_Date,'YYYY-MM-DD') as Date_OTILL,

      User_Details,

      Shift_ID,

      //User_Home_Depot,

      LEFT(User_Home_Depot,8) & '_' & Date(Shift_Date,'YYYY-MM-DD') as OTILL_JOINKEY,

      BD_Number,

      Transaction_Count,

      Credit_Card,

      Cash,

      Cheque,

      Total_Amount

  FROM

  [\\03rnb-qlkvw01\D\QVData\Elija's_QVD's\OnlineTill_Master.qvd] (qvd);

end if

if LastFile > SavedLastFile then

       Store OnlineTill into [\\03rnb-qlkvw01\D\QVData\Elija's_QVD's\OnlineTill_Master.qvd];

       Drop Table OnlineTill;

end if

1 Reply
VishalWaghole
Specialist II
Specialist II

Hi Elijah,

Please find link,

Script for Incremental Loading of Multiple QVDs from a List of Table Names

Hope it will make help you to solve your problem.

- Regards,

Vishal Waghole