2 Replies Latest reply: Jul 6, 2011 2:59 AM by Kaushik Solanki RSS

    Load from latest date's folder

    Gerhard Laubscher

      Hi,

       

      Our system generated reports every day, and then sends ot to a folder called "Einstein Reports".

       

      If I open this folder there will be folders for every year, in such a folder will be folders for every month and in such a folder will be folders for every day.

       

      So the last day of June will be        L:\Einstein Folders\2011\062011\30062011

      And the next day will be                 L:\Einstein Folders\2011\072011\01072011

       

      In many of my QV files I use the latest day's extracts. Usually I copy the files to my local drive and then use a FROM statement something like [C:\Reports\Application Extracts\Daily_Application_Extract*.txt]. Some files I concatenate daily and others I replace daily.

       

      What I would like to know is how I can, in my FROM statement, automatically have the script look at the LATEST day's folder so I can just open and reload my QlikView apps without having to do anything manually.

       

      Example:

       

      Account Extract:     ***I replace this file every day

       

      LOAD [1],

                [2]

      FROM [L:\Einstein Reports\2011\"The latest month"\"The latest day"\Daily_Account_Extract_*.txt]

       

       

      Transaction Extract:        ***I Concatenate every daily file

       

      CONCATENATE LOAD [1],

                               [2],

      FROM [

      [L:\Einstein Reports\2011\"The latest month"\"The latest day"\Daily_Transaction_Extract_*.txt]

               

       

      Thanks,

       

      Gerhard

        • Load from latest date's folder
          Jonathan De Deken

          Hi,

           

          You just need to define a parameter which you then use in the from:

          Set Path = 'L:\Einstein Reports\2011\' & Year(tpday()) & month(today()) &' \' & Year(tpday()) & month(today()) & '\

          Daily_Transaction_Extract_*.txt';

           

          Load

          [1],

                    [2]

          FROM $('Path');

           

           

          Regards,

           

          Jonathan

          • Load from latest date's folder
            Kaushik Solanki

            Hi,

             

              Create two variables which will store the latest month and current day.

             

              Like this,

             

              Let LMonth = Date(Today(),'MMYYYY');

               Let LDay = Date(Today(),'DDMMYYYY');

             

              Load [1],[2]

               From

              'L:\Einstein Reports\2011\'& $(LMonth)& '\'& $(LDay) &'\Daily_Transaction_Extract_*.txt'

             

            Regards,

            Kaushik Solanki