3 Replies Latest reply: Apr 20, 2012 7:59 AM by s j RSS

    Incremental load

      Hi All!

      I really need help:

      Below code m using for incremental:

       

       

       

      LET Starttime =Now();

      Max:

      LOAD

           Max(CreatedDate) as MaxDate

       

      FROM

      F:\Qlikview_Development\BACKUP\Stage1\QVDs\TBL_CURRENTSTOCKUPLOAD_INCR.qvd

      (qvd);

       

       

      Let MaxDate1=TimeStamp(Peek('MaxDate',0,'Max'));

       

       

      Let MaxTIMESTAMP=Timestamp($(#MaxDate1),'M/DD/YYYY h:mm:ss TT'); //*****  4/12/2012 6:29:30 PM

       

       

       

       

      new_datastock:

      LOAD

          DistCode,

           LcnId,

           LcnName,

           PrdId,

           PrdCode,

           PrdName,

           PrdBatId,

           PrdBatchCode,

           PrdBatLcnSih,

           PrdBatLcnUih,

           PrdBatLcnFre,

           PrdBatLcnRessih,

           PrdBatLcnResUih,

           PrdBatLcnResFre,

           UploadedDate,

           CreatedUserID,

           CreatedDate;

      SQL SELECT *

      FROM NestleConsole.dbo."TBL_CURRENTSTOCKUPLOAD"

      WHERE CreatedDate > '$(MaxTIMESTAMP)' ;

       

      But code is picking the the data as if ">="  not ">" MaxTIMESTAMP.

        • Incremental load
          Ashutosh Paliwal

          Hi,

          Since you are writing it in SQL select statement then I would suggest you to convert first it to proper date format by using to_date() or to_char() function. (Native date format function in your source DB).

          and then pass this variable to this date function which will make the variable value to a proper date.

          such as   to_date('070903', 'MMDDYY')

           

           

          ..

          Ashutosh

            • Incremental load

              Not working!!!

                • Incremental load
                  s j

                  Hii Erica

                   

                  You can use following logic for increamental load .

                   

                  Let ThisExecTime = Now( );

                   

                  QV_Table:

                  SQL SELECT PrimaryKey, X, Y FROM DB_TABLE

                  WHERE ModificationTime >= #$(LastExecTime)#

                  AND ModificationTime < #$(ThisExecTime)#;

                   

                  Concatenate LOAD PrimaryKey, X, Y FROM File.QVD

                  WHERE NOT EXISTS(PrimaryKey);

                   

                  Inner Join SQL SELECT PrimaryKey FROM DB_TABLE;

                   

                  If ScriptErrorCount = 0 then

                  STORE QV_Table INTO File.QVD;

                  Let LastExecTime = ThisExecTime;

                  End If