<?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: Using variables in Load statement in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-variables-in-Load-statement/m-p/371105#M1176317</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Simon,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's difficult to give the right answer without checking the code, but anyway, yours should look like this&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"&gt;&lt;P&gt;// Variable definition and assignment&lt;/P&gt;&lt;P&gt;SET vHighLimit = 3000;&lt;/P&gt;&lt;P&gt;SET vLowLimit = 50;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// WHERE clause in the LOAD statement using both variables&lt;/P&gt;&lt;P&gt;Invoices:&lt;/P&gt;&lt;P&gt;LOAD InvoiceID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CustomerID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Amount&lt;/P&gt;&lt;P&gt;WHERE Amount &amp;gt;= $(vLowLimit) AND Amount &amp;lt;= $(vHighLimit);&lt;/P&gt;&lt;P&gt;SQL SELECT InvoiceID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CustomerID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Amount&lt;/P&gt;&lt;P&gt;FROM db.Table;&lt;/P&gt;&lt;/PRE&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>Mon, 28 May 2012 10:52:47 GMT</pubDate>
    <dc:creator>Miguel_Angel_Baeyens</dc:creator>
    <dc:date>2012-05-28T10:52:47Z</dc:date>
    <item>
      <title>Using variables in Load statement</title>
      <link>https://community.qlik.com/t5/QlikView/Using-variables-in-Load-statement/m-p/371104#M1176316</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi , I'm trying to limit the data that gets loaded into a view. I have created a couple of variables that represent outstanding quantity and un-invoiced quantity. However , when I try and included them in the load ( if either are greater than zero ) they are not recognised. When I look at the variables available in the script they do not appear. Is it not possible to do this or have I not defined them correctly ? Many thanks. Simon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 May 2012 10:48:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-variables-in-Load-statement/m-p/371104#M1176316</guid>
      <dc:creator />
      <dc:date>2012-05-28T10:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: Using variables in Load statement</title>
      <link>https://community.qlik.com/t5/QlikView/Using-variables-in-Load-statement/m-p/371105#M1176317</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Simon,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's difficult to give the right answer without checking the code, but anyway, yours should look like this&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"&gt;&lt;P&gt;// Variable definition and assignment&lt;/P&gt;&lt;P&gt;SET vHighLimit = 3000;&lt;/P&gt;&lt;P&gt;SET vLowLimit = 50;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// WHERE clause in the LOAD statement using both variables&lt;/P&gt;&lt;P&gt;Invoices:&lt;/P&gt;&lt;P&gt;LOAD InvoiceID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CustomerID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Amount&lt;/P&gt;&lt;P&gt;WHERE Amount &amp;gt;= $(vLowLimit) AND Amount &amp;lt;= $(vHighLimit);&lt;/P&gt;&lt;P&gt;SQL SELECT InvoiceID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CustomerID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Amount&lt;/P&gt;&lt;P&gt;FROM db.Table;&lt;/P&gt;&lt;/PRE&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>Mon, 28 May 2012 10:52:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-variables-in-Load-statement/m-p/371105#M1176317</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2012-05-28T10:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using variables in Load statement</title>
      <link>https://community.qlik.com/t5/QlikView/Using-variables-in-Load-statement/m-p/371106#M1176318</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just to make things right, there is one small mistake:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;CODE class="jive-code"&gt;WHERE Amount &amp;gt;= $(vLowLimit) AND Amount &amp;lt;= $(vHighLimit);&lt;/CODE&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you shoud write&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;CODE class="jive-code"&gt;WHERE Amount &amp;gt;= '$(vLowLimit)' AND Amount &amp;lt;= '$(vHighLimit)';&lt;/CODE&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Mar 2013 08:47:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-variables-in-Load-statement/m-p/371106#M1176318</guid>
      <dc:creator />
      <dc:date>2013-03-30T08:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: Using variables in Load statement</title>
      <link>https://community.qlik.com/t5/QlikView/Using-variables-in-Load-statement/m-p/371107#M1176319</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;Thanks for noting, but that will only apply if the WHERE Amount is expecting a literal or a string, if it's expecting a numeric value, then you must not use the quotes. And since the Amount field usually stores numeric values, therefore my use of the variables without quotes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually, depending on the driver and the database, using the quotes is casting the value in the variable to string, and it might make the load slower, as the driver has to prior cast the value to numeric, then compare to match the WHERE clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Miguel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Mar 2013 09:05:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-variables-in-Load-statement/m-p/371107#M1176319</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2013-03-30T09:05:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using variables in Load statement</title>
      <link>https://community.qlik.com/t5/QlikView/Using-variables-in-Load-statement/m-p/371108#M1176320</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;before using the variable in the load statement of script, set a field level trigger on the particular field whose value will be stored in variable.&lt;/P&gt;&lt;P&gt;Add on select action as set variable.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="gr1.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/86508_gr1.png" style="height: 465px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;Give the variable name. and in expression mention the field name.&lt;/P&gt;&lt;P&gt;using it in the load statement will fetch the desired results.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 09:23:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-variables-in-Load-statement/m-p/371108#M1176320</guid>
      <dc:creator />
      <dc:date>2015-05-14T09:23:59Z</dc:date>
    </item>
  </channel>
</rss>

