<?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 Use of variables in an sql query in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Use-of-variables-in-an-sql-query/m-p/320286#M581945</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a report where the user first select a period to list all valid batchid for that spesific day.&lt;/P&gt;&lt;P&gt;When this is done 3 list box are filled with some data.&lt;/P&gt;&lt;P&gt;1: batch start time, in full timestamp, ie: '12-04-2011 09:00:00'&lt;/P&gt;&lt;P&gt;2: batch stop time, also in full timestamp.&lt;/P&gt;&lt;P&gt;3: valves&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The user is then required to choose a start- and stoptime, also at least one valve to examine.&lt;/P&gt;&lt;P&gt;I now need to put these 3 parameters into a sql query statment and reload the report with this values.&lt;/P&gt;&lt;P&gt;The feedback will be presented as a graph.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If run the sql statment without any vairables like the one below, it works.&lt;/P&gt;&lt;P&gt;SQL EXEC master.dbo.xp_AnalogWideHistory '11-11-2011 07:00:00', '11-11-2011 10:00:00', 10000,'3201L50H007.PV';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BUT, if I change it to use variables it fails.&lt;/P&gt;&lt;P&gt;SQL EXEC master.dbo.xp_AnalogWideHistory '$(vBatchStartTime)', '$(vBatchStopTime)', 10000, '$(vTag)';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created 3 textboxes where I display the variables, and that seems to be correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have not created any button for the user to reload, I just use ctrl+R, and obviously that is not how we should do it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I create a function so that the user can reload after all valid chooses have been made?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any hint or ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Nov 2011 10:05:08 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2011-11-15T10:05:08Z</dc:date>
    <item>
      <title>Use of variables in an sql query</title>
      <link>https://community.qlik.com/t5/QlikView/Use-of-variables-in-an-sql-query/m-p/320286#M581945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a report where the user first select a period to list all valid batchid for that spesific day.&lt;/P&gt;&lt;P&gt;When this is done 3 list box are filled with some data.&lt;/P&gt;&lt;P&gt;1: batch start time, in full timestamp, ie: '12-04-2011 09:00:00'&lt;/P&gt;&lt;P&gt;2: batch stop time, also in full timestamp.&lt;/P&gt;&lt;P&gt;3: valves&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The user is then required to choose a start- and stoptime, also at least one valve to examine.&lt;/P&gt;&lt;P&gt;I now need to put these 3 parameters into a sql query statment and reload the report with this values.&lt;/P&gt;&lt;P&gt;The feedback will be presented as a graph.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If run the sql statment without any vairables like the one below, it works.&lt;/P&gt;&lt;P&gt;SQL EXEC master.dbo.xp_AnalogWideHistory '11-11-2011 07:00:00', '11-11-2011 10:00:00', 10000,'3201L50H007.PV';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BUT, if I change it to use variables it fails.&lt;/P&gt;&lt;P&gt;SQL EXEC master.dbo.xp_AnalogWideHistory '$(vBatchStartTime)', '$(vBatchStopTime)', 10000, '$(vTag)';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created 3 textboxes where I display the variables, and that seems to be correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have not created any button for the user to reload, I just use ctrl+R, and obviously that is not how we should do it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I create a function so that the user can reload after all valid chooses have been made?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any hint or ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2011 10:05:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-of-variables-in-an-sql-query/m-p/320286#M581945</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-11-15T10:05:08Z</dc:date>
    </item>
    <item>
      <title>Use of variables in an sql query</title>
      <link>https://community.qlik.com/t5/QlikView/Use-of-variables-in-an-sql-query/m-p/320287#M581946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have now created a button that allows me to reload the current application.&lt;/P&gt;&lt;P&gt;But I still cant figure out how to make the selected variables valid in my sql quer statment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My button uses this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub Reload&lt;/P&gt;&lt;P&gt;ActiveDocument.Reload&lt;/P&gt;&lt;P&gt;ActiveDocument.Save&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2011 11:58:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-of-variables-in-an-sql-query/m-p/320287#M581946</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-11-15T11:58:17Z</dc:date>
    </item>
    <item>
      <title>Use of variables in an sql query</title>
      <link>https://community.qlik.com/t5/QlikView/Use-of-variables-in-an-sql-query/m-p/320288#M581947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I needed to create both one button for reload and three buttons for each variable to save the variables.&lt;/P&gt;&lt;P&gt;When saved I can run the reload and it will ise the variables as needed.&lt;/P&gt;&lt;P&gt;It might be possible to create a save function that saves all three variables at one time. will try to solve that one next.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Big thanks to my self &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Nov 2011 17:14:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-of-variables-in-an-sql-query/m-p/320288#M581947</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-11-16T17:14:08Z</dc:date>
    </item>
  </channel>
</rss>

