<?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 Re: Dynamic updates to SQL WHERE clause in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Dynamic-updates-to-SQL-WHERE-clause/m-p/618578#M227939</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The way object-level triggers are handled changed in, I believe, v10 or maybe v11. Instead of having a Triggers tab in the Properties for each object, they were moved to the Document Settings level. As Ivan mentioned, you can use triggers that fire by document, field, or variable events. There are also still the sheet level triggers for OnActivateSheet and OnLeaveSheet, but those won't help you here, beyond setting default selections.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your case you could use a field trigger, but to do things the way you mentioned, a new query will be generated each time a user clicks a new value. To avoid a new query each time a new date range is selected, you could use a variable trigger along with a button to set that up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, since QlikView is perfectly capable of handling huge data sets with grace, I would follow Bill's suggestion and load everything in the app, and just handle what is displayed by appropriate selectors. I would recommend using a calendar control with a slider to allow the user to dynamically choose the date range they want to analyze. Or there is always the common set up using selectors for Year, Quarter, Month and Day, or a combination of those techniques.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Scott Moon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 08 Feb 2014 03:05:31 GMT</pubDate>
    <dc:creator>smoon63</dc:creator>
    <dc:date>2014-02-08T03:05:31Z</dc:date>
    <item>
      <title>Dynamic updates to SQL WHERE clause</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-updates-to-SQL-WHERE-clause/m-p/618572#M227933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I pretty confident that want I want to do is not the QV Correct way and maybe some of you QV gurus could tell me the preferred method. But, we have a bunch of queries of which this is probably the simplest by far that are being ported from another dashboarding tool over to QV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The commonly occurring pattern we have is to have drop downs, normally built from a table that when selected update graphs, text fields, tables and gauges. Probably multiple items per drop down change.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would normally have bound a control to the where clause such as in my example script below.&lt;/P&gt;&lt;P&gt;So the query does what I want and returns the initial value back for 360 days as per the variable initialisation. &lt;/P&gt;&lt;P&gt;So my first question in this forum is how do I bind this to a QV List so that when the value is selected it forces an update.&lt;/P&gt;&lt;P&gt;In QV I have rendered the one value returned by the query in a text box.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET SelectedDays = 365;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Days:&lt;/P&gt;&lt;P&gt;Load * Inline &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Days &lt;/P&gt;&lt;P&gt;7, 30, 60, 90, 120, 365, 720]; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OLEDB CONNECT TO [Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=FinanceDB=WIN-05BI;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=WIN-05BIJREC3J4;Use Encryption for Data=False;Tag with column collation when possible=False];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQL SELECT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum(rspdCaseExtended.TotalCostEntered) AS TotalCostEntered&lt;/P&gt;&lt;P&gt;FROM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rspdCaseBase INNER JOIN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rspdCaseExtended ON rspdCaseBase.Id = rspdCaseExtended.Id&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE&amp;nbsp; rspdCaseExtended.TotalCostEntered &amp;lt;&amp;gt; 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and DATEDIFF(d, rspdCaseBase.CreatedTime,getdate()) &amp;lt;= $(SelectedDays)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Feb 2014 19:50:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-updates-to-SQL-WHERE-clause/m-p/618572#M227933</guid>
      <dc:creator />
      <dc:date>2014-02-06T19:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic updates to SQL WHERE clause</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-updates-to-SQL-WHERE-clause/m-p/618573#M227934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Kevin&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I may well be misunderstanding what you are after, but how about you load the data from all the dates into QlikView.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then having created suitable QlikView objects you can select the date&lt;S&gt; that you wish displayed.&lt;/S&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could maybe put your variable &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;EM&gt;SelectedDays &lt;/EM&gt;&lt;/SPAN&gt;into an input box, so that its value can adjusted by the user and exploit Set Analysis using&amp;nbsp; this variable &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;EM&gt;SelectedDays &lt;/EM&gt;&lt;/SPAN&gt;to just display data from your required date&lt;S&gt;.&lt;/S&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;Bill&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Feb 2014 20:02:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-updates-to-SQL-WHERE-clause/m-p/618573#M227934</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-02-06T20:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic updates to SQL WHERE clause</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-updates-to-SQL-WHERE-clause/m-p/618574#M227935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the fast reply Bill!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did expect that someone would come back with your suggestion, I suspect that would be the natural way for QV to want to handle this type of scenario.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have a lot of rows of data and many, many dates in that data going back many years so didn't really want to consume a ton of memory for one number. I'm not a DB guru so that could well be the wrong way to look at it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This example is one of many and I'm trying to refactor them all as little as possible. Some of the queries I have have some really complicated joins. I accept I'm trying to be lazy &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Feb 2014 00:43:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-updates-to-SQL-WHERE-clause/m-p/618574#M227935</guid>
      <dc:creator />
      <dc:date>2014-02-07T00:43:18Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic updates to SQL WHERE clause</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-updates-to-SQL-WHERE-clause/m-p/618575#M227936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think what you want is a good idea but you can try to accomplish this by using an input box with preset values for you variable and then button with external action partial reload. Or instead of button just a trigger on variable set or change.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Feb 2014 01:45:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-updates-to-SQL-WHERE-clause/m-p/618575#M227936</guid>
      <dc:creator>iktrayanov</dc:creator>
      <dc:date>2014-02-07T01:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic updates to SQL WHERE clause</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-updates-to-SQL-WHERE-clause/m-p/618576#M227937</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Ivan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is using a button the only way to get it to refresh, there's no action on a selection of a list? I couldn't find one.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Feb 2014 07:46:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-updates-to-SQL-WHERE-clause/m-p/618576#M227937</guid>
      <dc:creator />
      <dc:date>2014-02-07T07:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic updates to SQL WHERE clause</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-updates-to-SQL-WHERE-clause/m-p/618577#M227938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use trigger.&lt;/P&gt;&lt;P&gt; Settings&amp;gt;Document Properties&amp;lt;Triggers&amp;gt; Variable Event Triggers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Feb 2014 13:47:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-updates-to-SQL-WHERE-clause/m-p/618577#M227938</guid>
      <dc:creator>iktrayanov</dc:creator>
      <dc:date>2014-02-07T13:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic updates to SQL WHERE clause</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-updates-to-SQL-WHERE-clause/m-p/618578#M227939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The way object-level triggers are handled changed in, I believe, v10 or maybe v11. Instead of having a Triggers tab in the Properties for each object, they were moved to the Document Settings level. As Ivan mentioned, you can use triggers that fire by document, field, or variable events. There are also still the sheet level triggers for OnActivateSheet and OnLeaveSheet, but those won't help you here, beyond setting default selections.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your case you could use a field trigger, but to do things the way you mentioned, a new query will be generated each time a user clicks a new value. To avoid a new query each time a new date range is selected, you could use a variable trigger along with a button to set that up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, since QlikView is perfectly capable of handling huge data sets with grace, I would follow Bill's suggestion and load everything in the app, and just handle what is displayed by appropriate selectors. I would recommend using a calendar control with a slider to allow the user to dynamically choose the date range they want to analyze. Or there is always the common set up using selectors for Year, Quarter, Month and Day, or a combination of those techniques.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Scott Moon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Feb 2014 03:05:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-updates-to-SQL-WHERE-clause/m-p/618578#M227939</guid>
      <dc:creator>smoon63</dc:creator>
      <dc:date>2014-02-08T03:05:31Z</dc:date>
    </item>
  </channel>
</rss>

