2 Replies Latest reply: Jul 27, 2014 7:55 PM by Srikanth P RSS

    Insert dynamic value into my load table

      Hello everyboqy i met an problem,

       

      I explain, i ve an 'extract script" wich extract for every society an FACT table but the information of the society is not into the FACT table and i woul like to add this informatio into all  my society FACT table .....

       

       

      For that, I try to put into an new field  "Society" an dynamic value but it doesn't work and i don t know how to do...

       

      For the moment, I use  an

       

      SET ListeSte={‘name_society1’, ‘name_society2’,etc….}

       

       

      FOR each SteEnCours in $(ListeSte)
      trace ----------------------------$(SteEnCours)-------------------------------------; //$(SteEnCours)
      ODBC CONNECT32 TO $(SteEnCours);

       

      Table_FACT :

       

      LOAD

       

      $(SteEnCours) as Society,

      Field1,

      Field2,

      Field3,

      Etc…

      From 

      SQL  SELECT....

      etcC….

       

      STORE Table_FACT into "    .........\$(SteEnCours)_Table_FACT .qvd";

      DROP TABLE Table_FACT ;

       

       

      But the problem with this code the value of society is not the name_society1,2,etc...

      For each society table fact the value of the field is = '$(SteEnCours)''

       

      Do you have any idea how to put an value dynamic into my table....

       

      Thanks

      Pierre

        • Re: Insert dynamic value into my load table
          Sandeep Talanki

          Hi Pierre,

           

          Use quotes for the variable in  LOAD '$(SteEnCours)' as Society,

           

          SET ListeSte=‘name_society1’, ‘name_society2’;



          FOR each SteEnCours in $(ListeSte)
          trace ----------------------------$(SteEnCours)-------------------------------------; //$(SteEnCours)
          ODBC CONNECT32 TO $(SteEnCours);

           


          Table_FACT :


          LOAD


          '$(SteEnCours)' as Society,

          Field1,

          Field2,

          Field3,

          Etc…

          From 

          SQL  SELECT....

          etcC….


          STORE Table_FACT into "    .........\$(SteEnCours)_Table_FACT .qvd";

          DROP TABLE Table_FACT ;

          Next

          • Re: Insert dynamic value into my load table
            Srikanth P

            Hi, You can pass the variable value into field name as well.

             

            Please use the below script:

             

            SET ListeSte={‘name_society1’, ‘name_society2’,etc….}

             

             

            FOR each SteEnCours in $(ListeSte)
            trace ----------------------------$(SteEnCours)-------------------------------------;//$(SteEnCours)
            ODBC CONNECT32 TO $(SteEnCours);

             

            Table_FACT :

             

            LOAD

             

            '$(SteEnCours)' as [$(ListeSte)],

            Field1,

            Field2,

            Field3,

            Etc…

            From

            SQL  SELECT....

            etcC….

             

            STORE Table_FACT into "    .........\$(SteEnCours)_Table_FACT .qvd";

            DROP TABLE Table_FACT ;