<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic QlikView Variable in Where Clause in Direct Query in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/QlikView-Variable-in-Where-Clause-in-Direct-Query/m-p/1675698#M449755</link>
    <description>&lt;P&gt;We have a hybrid approach while loading a data. i.e. one table is in memory and the other is Direct Query.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the script.&lt;/P&gt;&lt;P&gt;InMemoryTable:&lt;BR /&gt;LOAD Country as Country1;&lt;BR /&gt;SQL SELECT DISTINCT Country FROM EmployeeVw;&lt;/P&gt;&lt;P&gt;DirectQueryTable:&lt;BR /&gt;DIRECT QUERY&lt;BR /&gt;DIMENSION&lt;BR /&gt;[EMPID]&lt;BR /&gt;,[BusinessType]&lt;BR /&gt;,[Year]&lt;BR /&gt;,[CompanyName]&lt;BR /&gt;,[FullName]&lt;BR /&gt;,[Country]&lt;BR /&gt;,[Region]&lt;BR /&gt;,[Contact]&lt;/P&gt;&lt;P&gt;MEASURE&lt;BR /&gt;[Revenue]&lt;BR /&gt;,[Sales]&lt;BR /&gt;,[Profit]&lt;/P&gt;&lt;P&gt;FROM&amp;nbsp;EmployeeVw;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;on UI, we have a chart showing Profit by Country &amp;amp; a listbox &lt;STRONG&gt;Country1 &lt;/STRONG&gt;(note that this column belongs to the inmemory table)&amp;nbsp;. We need to build the dashboard in such a way that once a value in &lt;STRONG&gt;Country1&lt;/STRONG&gt; 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(&lt;STRONG&gt;Country1&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;We want to put hat variable at the where clause at the end of our Direct Data Query like below.&lt;/P&gt;&lt;P&gt;FROM&amp;nbsp;EmployeeVw Where Country = '$(vCountry)';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;Can someone please suggest us a solution to this issue and how we can achieve passing a QlikView variable in the&amp;nbsp; Where clause of the Direct Query?&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 19:06:55 GMT</pubDate>
    <dc:creator>HimanshuKakade</dc:creator>
    <dc:date>2024-11-16T19:06:55Z</dc:date>
    <item>
      <title>QlikView Variable in Where Clause in Direct Query</title>
      <link>https://community.qlik.com/t5/QlikView/QlikView-Variable-in-Where-Clause-in-Direct-Query/m-p/1675698#M449755</link>
      <description>&lt;P&gt;We have a hybrid approach while loading a data. i.e. one table is in memory and the other is Direct Query.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the script.&lt;/P&gt;&lt;P&gt;InMemoryTable:&lt;BR /&gt;LOAD Country as Country1;&lt;BR /&gt;SQL SELECT DISTINCT Country FROM EmployeeVw;&lt;/P&gt;&lt;P&gt;DirectQueryTable:&lt;BR /&gt;DIRECT QUERY&lt;BR /&gt;DIMENSION&lt;BR /&gt;[EMPID]&lt;BR /&gt;,[BusinessType]&lt;BR /&gt;,[Year]&lt;BR /&gt;,[CompanyName]&lt;BR /&gt;,[FullName]&lt;BR /&gt;,[Country]&lt;BR /&gt;,[Region]&lt;BR /&gt;,[Contact]&lt;/P&gt;&lt;P&gt;MEASURE&lt;BR /&gt;[Revenue]&lt;BR /&gt;,[Sales]&lt;BR /&gt;,[Profit]&lt;/P&gt;&lt;P&gt;FROM&amp;nbsp;EmployeeVw;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;on UI, we have a chart showing Profit by Country &amp;amp; a listbox &lt;STRONG&gt;Country1 &lt;/STRONG&gt;(note that this column belongs to the inmemory table)&amp;nbsp;. We need to build the dashboard in such a way that once a value in &lt;STRONG&gt;Country1&lt;/STRONG&gt; 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(&lt;STRONG&gt;Country1&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;We want to put hat variable at the where clause at the end of our Direct Data Query like below.&lt;/P&gt;&lt;P&gt;FROM&amp;nbsp;EmployeeVw Where Country = '$(vCountry)';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;Can someone please suggest us a solution to this issue and how we can achieve passing a QlikView variable in the&amp;nbsp; Where clause of the Direct Query?&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 19:06:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/QlikView-Variable-in-Where-Clause-in-Direct-Query/m-p/1675698#M449755</guid>
      <dc:creator>HimanshuKakade</dc:creator>
      <dc:date>2024-11-16T19:06:55Z</dc:date>
    </item>
  </channel>
</rss>

