2 Replies Latest reply: Oct 18, 2012 5:12 AM by cedricfr RSS

    transform columns in header

      Hi,

       

      I would transform a columns to header in a script, but I don't found any solution.

       

      For example,I have this data :

       

      IdKeyValue
      1AZE10
      1QSD30
      2AZE25
      3WXC60
      4AZE20
      4QSD60
      4WXC90

       

      And I would obtain this :

       

      IdAZEQSDWXC
      11030
      225

      3

      60
      4206090

       

      Have you an idea, how to do this ?

       

      Thank you in advance

       

      Cédric

        • Re: transform columns in header
          Lav Jain

          Hi,

           

          use

           

          generic LOAD Id,

               Key,

               Value

           

          FROM Excel;

           

           

          Mark answered if it helps

          • Re: transform columns in header

            Hi

             

            If someone have the same problem, there is my code :

             

            tmp:
            Generic LOAD * Resident tbl_source;
            
            Result:
            load distinct ID resident tbl_source;
            
            drop table tbl_source;
            
            FOR i = 0 to NoOfTables()
            
            TableList:
            LOAD TableName($(i)) as Tablename AUTOGENERATE 1
            WHERE WildMatch(TableName($(i)), 'tmp.*');
            NEXT i
            
            
            FOR i = 1 to FieldValueCount('Tablename')
            LET vTable = FieldValue('Tablename', $(i));
            LEFT JOIN (Result) LOAD * RESIDENT $(vTable);
            DROP TABLE $(vTable);
            NEXT i
            
            drop table TableList;
            

             

            Thank you for your help

             

            Cédric