Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
HimanshuKakade
Contributor
Contributor

QlikView Variable in Where Clause in Direct Query

We have a hybrid approach while loading a data. i.e. one table is in memory and the other is Direct Query. 

Below is the script.

InMemoryTable:
LOAD Country as Country1;
SQL SELECT DISTINCT Country FROM EmployeeVw;

DirectQueryTable:
DIRECT QUERY
DIMENSION
[EMPID]
,[BusinessType]
,[Year]
,[CompanyName]
,[FullName]
,[Country]
,[Region]
,[Contact]

MEASURE
[Revenue]
,[Sales]
,[Profit]

FROM EmployeeVw;

 

on UI, we have a chart showing Profit by Country & a listbox Country1 (note that this column belongs to the inmemory table) . We need to build the dashboard in such a way that once a value in Country1 is selected from the listbox, only then a table will appear and show the data for that Country. We are thinking to create a variable (vCountry) that will hold the value for GetFieldSelections(Country1)

We want to put hat variable at the where clause at the end of our Direct Data Query like below.

FROM EmployeeVw Where Country = '$(vCountry)';

 

When we tried that we observed that the variable value is not being passed to the direct query and hence the data from the direct query is not filtering as per the requirement.

Can someone please suggest us a solution to this issue and how we can achieve passing a QlikView variable in the  Where clause of the Direct Query?

Labels (2)
0 Replies