Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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.

2 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

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

Not applicable
Author

Hi Celambarasan,

Thanks for reply, it appears to do exactly what I am after. Sorry Itook a while to reply but I have beenaway and only just checked for replies. Thank you for your help.

Rufus