2 Replies Latest reply: May 2, 2012 9:42 PM by rufus001 RSS

    Variable Table Names

      I am an absolute beginner with QlikView. I am trying to specify a table in my Script (reading from a MSSQL database), but the table name is not constant. Essentially the first part of the table name is a prefix denoting the company I wish to query on. Eg the table name is in the format XXX_CUSTOMER, so I can have many CUSTOMER tables (e.g. ABC_CUSTOMER, 123_CUSTOMER, XYZ_CUSTOMER etc). I would like to write one script in which the prefix of the table name is variable as all the tables will have an identical layout. Can someone please help me. Many Thank rufus001.

        • Re: Variable Table Names
          Celambarasan Adhimulam

          Hi,

               You mean you will get the list of Company names in one table that you will query like

               CompanyTable:

               SELECT Distinct Company From CompanyTable;

          Then you have to fetch other table based on the company from the above query result like below?

           

               For i=0 to NoOfRows('CompanyTable')-1

               vCompany = Peek('Company',$(i),CompanyTable);

               NoConcatenate

               $(vCompany)_CUSTOMER:

               SELECT

                    *

               FROM $(vCompany)_CUSTOMER:

               Next i;

           

          Celambarasan