<?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: Passing a variable from input box to SQL in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Passing-a-variable-from-input-box-to-SQL/m-p/397893#M491008</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;If the variable already exists in your input box in the design, you can check its contents in the Settings menu, Variable Overview. If that's OK, then the SQL should look like the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13498608726575584" jivemacro_uid="_13498608726575584"&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;WHERE ol_kapa = 'A' AND (date(ol_onaydt) BETWEEN &lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-family: Arial; color: #ff0000;"&gt;&lt;STRONG&gt;'$(basTarih)&lt;/STRONG&gt;'&lt;/SPAN&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt; AND '2012-10-08')&lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So QlikView returns the value of the variable and so it's passed on to the ODBC driver and the database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Miguel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Oct 2012 09:22:01 GMT</pubDate>
    <dc:creator>Miguel_Angel_Baeyens</dc:creator>
    <dc:date>2012-10-10T09:22:01Z</dc:date>
    <item>
      <title>Passing a variable from input box to SQL</title>
      <link>https://community.qlik.com/t5/QlikView/Passing-a-variable-from-input-box-to-SQL/m-p/397892#M491007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to assign a value to a variable by creating an input box on the sheet, and then using that variable in the SQL select statement as a constraint.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe I have the variable correctly. When I go to the variable tab at the bottom of the edit script I see the value of basTarih as 2012-10-01.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I try to run the code this way I get an error saying that it cannot convert basTarih to timestamp. In the onput box properties number tab I've selected both date and timestamp formats for basTarih but none seem to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do I need a SET statement somewhere? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;siparis:&lt;/P&gt;&lt;P&gt;LOAD *;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQL SELECT ol_or_no1, ol_or_no2, ol_sr, ol_ma_kod AS ma_kod, ol_qty, ol_kapa, ol_ds_kod AS desen, ol_vry AS varyant, ol_plan_onay, date(ol_wrk_basdt), date(ol_onaydt),date(ol_terdt),&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ol_or_anhno, ol_onay2, date(ol_onay2dt),or_pe_no, or_anhno, or_rr_no&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;FROM DBA.ordln&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;JOIN DBA.ord&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ON ordln.ol_or_anhno = ord.or_anhno&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;WHERE ol_kapa = 'A' AND (date(ol_onaydt) BETWEEN &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;'&amp;amp;basTarih&lt;/STRONG&gt;'&lt;/SPAN&gt; AND '2012-10-08')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;order by ol_or_no2, ma_kod, desen, varyant&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2012 09:16:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Passing-a-variable-from-input-box-to-SQL/m-p/397892#M491007</guid>
      <dc:creator />
      <dc:date>2012-10-10T09:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a variable from input box to SQL</title>
      <link>https://community.qlik.com/t5/QlikView/Passing-a-variable-from-input-box-to-SQL/m-p/397893#M491008</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;If the variable already exists in your input box in the design, you can check its contents in the Settings menu, Variable Overview. If that's OK, then the SQL should look like the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13498608726575584" jivemacro_uid="_13498608726575584"&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;WHERE ol_kapa = 'A' AND (date(ol_onaydt) BETWEEN &lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-family: Arial; color: #ff0000;"&gt;&lt;STRONG&gt;'$(basTarih)&lt;/STRONG&gt;'&lt;/SPAN&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt; AND '2012-10-08')&lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So QlikView returns the value of the variable and so it's passed on to the ODBC driver and the database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Miguel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2012 09:22:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Passing-a-variable-from-input-box-to-SQL/m-p/397893#M491008</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2012-10-10T09:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a variable from input box to SQL</title>
      <link>https://community.qlik.com/t5/QlikView/Passing-a-variable-from-input-box-to-SQL/m-p/397894#M491009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Miguel, I've initially tried the $(basTarih) but I forgot he single quotes, thanks again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2012 09:24:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Passing-a-variable-from-input-box-to-SQL/m-p/397894#M491009</guid>
      <dc:creator />
      <dc:date>2012-10-10T09:24:56Z</dc:date>
    </item>
  </channel>
</rss>

