Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Using the WHERE Clause in an ODBC connection string

Hello,

Can anybody confirm whether or not I can use a WHERE clause in an ODBC connection?

For example:

I am able to connect to a MS Access Database and return all values as per below:

Script:

 

ODBC CONNECT32 TO [MS Access Database;DBQ=C:\Users\hayetom\Qlikview\Examples\Product.accdb];

LOAD `Product_ID`,

    `Product_Line`;

SQL SELECT *

FROM `DIM_Prod`;

Which returns:

Product_IDProduct_Line
1VL
2VL
3AB
4AB
5AB
6CD
7CD
8EF

However, I only want to return rows Where the Product_Line is either 'VL' or 'AB'. I have tried

ODBC CONNECT32 TO [MS Access Database;DBQ=C:\Users\hayetom\Qlikview\Examples\Product.accdb];

LOAD `Product_ID`,

    `Product_Line`;

SQL SELECT *

FROM `DIM_Prod` WHERE (Product_ID = 'VL' or Product_ID = 'AB');

NOTE: I appreciate that I can bring all the rows in and then limit my selection on the resident Load BUT I want to limit the data that is brought in the qvw to begin with.

Any ideas?

Tags (1)
1 Solution

Accepted Solutions
Not applicable

Re: Using the WHERE Clause in an ODBC connection string

Try using Product_Line in your Where clause, rather than Product_ID

3 Replies
lan
Not applicable

Re: Using the WHERE Clause in an ODBC connection string

Try this for your where clause.

where Product_ID in('VL','AB')

danielrozental
Not applicable

Re: Using the WHERE Clause in an ODBC connection string

Try referring to the field as it appears in the SELECT.

where `Product_ID` in('VL','AB')

Not applicable

Re: Using the WHERE Clause in an ODBC connection string

Try using Product_Line in your Where clause, rather than Product_ID