Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

How to write parameterized filter condition in query while fetching data

Hi,

I have a requirement where I need to pull data from a database and my filter condition should be parameterized and should come from a text/excel file. So that business user can open that text/excel file and can change the condition accordingly.

For example:

My query is:

Select *

from dbo.Customer

where customerID in (22, 12)

and StateID in (100, 102, 125)

Now in above query how can I store these customerID values & StateID values in text/excel and this query calls those parameters from that file and then execute. In a way it will be dynamic so tomorrow user can go to this file and change the parameter value and without chaning any code the script will still work.

Best Regards,

Sachin

Tags (1)
1 Solution

Accepted Solutions

Re: How to write parameterized filter condition in query while fetching data

If your xls file has 2 rows and one column in wich you have:

Values

(22, 12)

(100, 102, 125)

you can

MyTable:

Load

     Values

From myFileXls;

Let row1=Peek('Values',1,'MyTable');

Let row2=Peek('Values',2,'MyTable');

then your select will be

Select *

from dbo.Customer

where customerID in $(row1)

and StateID in  $(row2)

hope it helps

2 Replies

Re: How to write parameterized filter condition in query while fetching data

If your xls file has 2 rows and one column in wich you have:

Values

(22, 12)

(100, 102, 125)

you can

MyTable:

Load

     Values

From myFileXls;

Let row1=Peek('Values',1,'MyTable');

Let row2=Peek('Values',2,'MyTable');

then your select will be

Select *

from dbo.Customer

where customerID in $(row1)

and StateID in  $(row2)

hope it helps

Not applicable

Re: How to write parameterized filter condition in query while fetching data

Thanks. It worked for me....

Community Browser