<?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: Where clause with variable in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Where-clause-with-variable/m-p/734137#M1063580</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure to understand, as a guess/tip, you can build a bucle, ie:&lt;/P&gt;&lt;P&gt;Excel:&lt;/P&gt;&lt;P&gt;LOAD Date_Start&lt;/P&gt;&lt;P&gt;FROM ...xls (...);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR i=1 to fieldValueCount('Date_Start')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LET vDateStart = FieldValue(Date_Start, $(i));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOAD ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where OPE_DATE &amp;gt;= '$(vDateStart)'&lt;/P&gt;&lt;P&gt;NEXT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problably don't meet your requirements, it will load all data in 'Table' table, and two differents dates will create duplicate records, ie if first date is 01/02/2014 and 2nd date is 16/02/2014, both iteraton would load records where OPE_DATE &amp;gt;=16/02/2014 (as they are also &amp;gt;= 01/02/2014 and were loaded in first iteration)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Oct 2014 08:12:39 GMT</pubDate>
    <dc:creator>rubenmarin</dc:creator>
    <dc:date>2014-10-01T08:12:39Z</dc:date>
    <item>
      <title>Where clause with variable</title>
      <link>https://community.qlik.com/t5/QlikView/Where-clause-with-variable/m-p/734134#M1063574</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;When loading my data's, I'm restricting these using a where clause that looks like this:&lt;/P&gt;&lt;P&gt;where OPE_DATE &amp;gt;= '01/01/2014'&lt;/P&gt;&lt;P&gt;so it only selects data's starting on January 1st. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This script was used for some test and now that everything works, I would like to restrict the load on a variable.&lt;/P&gt;&lt;P&gt;In fact the data I'm loading, is coming from 5 printers (offset) and since the datas are not correct previous to a specific date, we defined that date for each printer in a excel file:&lt;/P&gt;&lt;P&gt;Printer Date_start&lt;/P&gt;&lt;P&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01/02/2014&lt;/P&gt;&lt;P&gt;B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 16/02/2014&lt;/P&gt;&lt;P&gt;C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;D&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;E&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm loading the excel file first and i tried to store it in a variable with:&lt;/P&gt;&lt;P&gt;LET vDateStart = Date_Start (the field where the information is written) and &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;when loading my datas, I would like the where clause to look like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;where OPE_DATE &amp;gt;= $(vDateStart)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but unfortenutalety it is not working &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; actually, the variable is not set because when I try to show the information of the variable in a textbox, nothing appears&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Oct 2014 07:34:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Where-clause-with-variable/m-p/734134#M1063574</guid>
      <dc:creator />
      <dc:date>2014-10-01T07:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: Where clause with variable</title>
      <link>https://community.qlik.com/t5/QlikView/Where-clause-with-variable/m-p/734135#M1063575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Roger, maybe the issue is when you assign the field to the variable, you can't assign a field, you need to assign a value of that field using functions like FieldValue or Peek, ie:&lt;/P&gt;&lt;P&gt;LET vDateStart = FieldValue(Date_Start, 1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, in the where clause you probably need to simple quote the variable, so 01/02/2014 don't pass as 01 divided by 02 divided by 2014, ie:&lt;/P&gt;&lt;P&gt;OPE_DATE &amp;gt;= '$(vDateStart)'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Oct 2014 07:42:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Where-clause-with-variable/m-p/734135#M1063575</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2014-10-01T07:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: Where clause with variable</title>
      <link>https://community.qlik.com/t5/QlikView/Where-clause-with-variable/m-p/734136#M1063577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks this should work &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you know if there is a way to automate this, because in a few weeks, we will add some machine to the list with other dates.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Oct 2014 07:59:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Where-clause-with-variable/m-p/734136#M1063577</guid>
      <dc:creator />
      <dc:date>2014-10-01T07:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: Where clause with variable</title>
      <link>https://community.qlik.com/t5/QlikView/Where-clause-with-variable/m-p/734137#M1063580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure to understand, as a guess/tip, you can build a bucle, ie:&lt;/P&gt;&lt;P&gt;Excel:&lt;/P&gt;&lt;P&gt;LOAD Date_Start&lt;/P&gt;&lt;P&gt;FROM ...xls (...);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR i=1 to fieldValueCount('Date_Start')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LET vDateStart = FieldValue(Date_Start, $(i));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOAD ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where OPE_DATE &amp;gt;= '$(vDateStart)'&lt;/P&gt;&lt;P&gt;NEXT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problably don't meet your requirements, it will load all data in 'Table' table, and two differents dates will create duplicate records, ie if first date is 01/02/2014 and 2nd date is 16/02/2014, both iteraton would load records where OPE_DATE &amp;gt;=16/02/2014 (as they are also &amp;gt;= 01/02/2014 and were loaded in first iteration)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Oct 2014 08:12:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Where-clause-with-variable/m-p/734137#M1063580</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2014-10-01T08:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: Where clause with variable</title>
      <link>https://community.qlik.com/t5/QlikView/Where-clause-with-variable/m-p/734138#M1063581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If PRINTER is another field you can filter then you can add it to the where clause:&lt;/P&gt;&lt;P&gt;Excel:&lt;/P&gt;&lt;P&gt;LOAD Printer,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date_Start&lt;/P&gt;&lt;P&gt;FROM ...xls (...);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR i=0 to NoOfRows('Excel')-1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LET vPrinter= Peek('Printer', $(i), 'Excel');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LET&amp;nbsp; vDateStart=Peek('Date_Start', $(i), 'Excel');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOAD ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where OPE_DATE &amp;gt;= '$(vDateStart)' and PRINTER='$(vPrinter)'&lt;/P&gt;&lt;P&gt;NEXT&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Oct 2014 08:20:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Where-clause-with-variable/m-p/734138#M1063581</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2014-10-01T08:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: Where clause with variable</title>
      <link>https://community.qlik.com/t5/QlikView/Where-clause-with-variable/m-p/734139#M1063582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot!! It works perfectly &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, 01 Oct 2014 08:52:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Where-clause-with-variable/m-p/734139#M1063582</guid>
      <dc:creator />
      <dc:date>2014-10-01T08:52:18Z</dc:date>
    </item>
  </channel>
</rss>

