2 Replies Latest reply: Apr 28, 2017 12:14 PM by Zied Ahmed RSS

    script for Preceding load

    Zied Ahmed

      Hello I have this code and i would like to use Preceding Load

       

      LOAD

          * WHERE  "date"= Today() ;

          load

             date,

       

                car as car,

               mat ,

               Tax,

               'ON'  as STATUT,

               count(Statut_sup) as nbr

               resident table1

               where Statut_sup='Actif'

               group by

              date_flotte,

               Taux,

               //[%Date ID],

               car ,

               mat;

            

             

               Concatenate  

                 load

            Pla,

           

              date,

               car as car,

               mat,

                 'OFF'  as STATUT,

               count(Statut_sup) as nbr

               resident table1

               where Statut_sup='Inactif'

               group by  date,

               car,

               mat,

      Pla;

              

           

                Concatenate  

                 load

             date,

           

               car as car,

               mat,

                'Bloquée'  as STATUT,

               count(Statut_sup) as nbr

               resident table1

               where Statut_sup='Bloquée'

               group by  date,

               car,

               mat;

      drop table table1;

             

          STORE [FlotteFinal] into [$(vQvdPath)\QVD_final.qvd](qvd);

       

                Concatenate

                   Load*

                   resident Fact ;

                   drop table Fact;

        • Re: script for Preceding load
          Pierre Guss

          Hi

           

          It is not possible to do a preceding load based on several LOAD instructions.

          Something like LOAD .... ; (Combination of load statements); would be great, but does not work, unfortunately.

           

          So you need to reorganise your script.

           

          UnlimitedTable:

          load

               date,

               car as car,

               mat ,

               Taux,

               'ON'  as STATUT,

               count(Statut_sup) as nbr

          resident

               table1

          where

               Statut_sup='Actif'

          group by

               date_flotte,

               Taux,

               car,

               mat;

           

          Concatenate  (UnlimitedTable)

          load

               Pla,

               date,

               car as car,

               mat,

               'OFF'  as STATUT,

               count(Statut_sup) as nbr

          resident

               table1

          where

               Statut_sup='Inactif'

          group by 

               date,

               car,

               mat,

               Pla;

           

          Concatenate  (UnlimitedTable)

          load

               date,

               car as car,

               mat,

               'Bloquée'  as STATUT,

               count(Statut_sup) as nbr

          resident

               table1

          where

               Statut_sup='Bloquée'

          group by     

               date,

               car,

               mat;

           

          // Now it is not clear to me if you want to store all data, or only data with date = today

          // If it is all data

          STORE UnlimitedTable INTO ...

          CONCATENATE (Fact) LOAD * RESIDENT UnlimitedTable WHERE date = today();

          DROP TABLE UnlimitedTable;

           

          // If it is only a subset of data (date = today)

          LimitedTable:

          NOCONCATENATE LOAD * RESIDENT UnlimitedTable WHERE date = today();

          STORE LimitedTable INTO...

          CONCATENATE (Fact) LOAD * RESIDENT LimitedTable;

          DROP TABLES UnlimitedTable, LimitedTable;

           

          Hope it helps