<?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: question about LET variables in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/question-about-LET-variables/m-p/742669#M1020832</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The first thing that happens during a script execution is that the old data model is deleted. Then the script starts building the new data model. The [Year] is a field in the old data model, and so it is not available during script execution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can do the following:&lt;/P&gt;&lt;P&gt;Alternative 1:&lt;/P&gt;&lt;P&gt;If you use &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Let vMaxYear = '=Max({1} Year)';&lt;/P&gt;&lt;P&gt;the variable will get calculated every time you click. But it will also keep its value during the script execution, so you can use it the way you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternative 2:&lt;/P&gt;&lt;P&gt;Calculate vMaxYear from the new data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MaxYear:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Load Max(Year) as MaxYear From &amp;lt;SourceTable&amp;gt; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Let vMaxYear = Peek('&lt;SPAN style="font-size: 13.3333330154419px;"&gt;MaxYear&lt;/SPAN&gt;',-1,'&lt;SPAN style="font-size: 13.3333330154419px;"&gt;MaxYear&lt;/SPAN&gt;');&lt;/P&gt;&lt;P&gt;Now you can use vMaxYear the way you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Mar 2015 14:37:20 GMT</pubDate>
    <dc:creator>hic</dc:creator>
    <dc:date>2015-03-18T14:37:20Z</dc:date>
    <item>
      <title>question about LET variables</title>
      <link>https://community.qlik.com/t5/QlikView/question-about-LET-variables/m-p/742667#M1020830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;my task is to define a LET variable that will return the maximal value in the field, and then to load only those records that correspond to the maximal value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying the following syntax. But it doesn't work. Is there any mistake?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;LET&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: gray;"&gt;vMaxYear&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; = &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;max&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Year]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;);&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt; Source:&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;LOAD&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Brand&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Year&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; C:\Users\Larisa.Filonova\Desktop\brand_data.xlsx&lt;BR /&gt; (&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;ooxml&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;embedded&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;labels&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;table&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;is&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; data)&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;where&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Year&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; = &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: gray;"&gt;$(vMaxYear) &lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: gray;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 9.0pt; font-family: 'Courier New';"&gt;Thank you in advance,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #000000;"&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9pt; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style=": ; color: #000000; font-size: 9.0pt; font-family: 'Courier New';"&gt;Larisa&lt;/STRONG&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: gray;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Mar 2015 14:23:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/question-about-LET-variables/m-p/742667#M1020830</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-18T14:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: question about LET variables</title>
      <link>https://community.qlik.com/t5/QlikView/question-about-LET-variables/m-p/742668#M1020831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Larisa, max(Year) won't work in script to assign value to a variable, one way to get that is create a table of years in descendig order and get the value of the first record, ie:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Years:&lt;/P&gt;&lt;P&gt;LOAD Distinct Year as YearSorted Resident Data Order by Year desc;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vMaxYear = Peek('YearSorted', 0, 'Years');&lt;/P&gt;&lt;P&gt;DROP Table Years;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Mar 2015 14:33:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/question-about-LET-variables/m-p/742668#M1020831</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2015-03-18T14:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: question about LET variables</title>
      <link>https://community.qlik.com/t5/QlikView/question-about-LET-variables/m-p/742669#M1020832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The first thing that happens during a script execution is that the old data model is deleted. Then the script starts building the new data model. The [Year] is a field in the old data model, and so it is not available during script execution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can do the following:&lt;/P&gt;&lt;P&gt;Alternative 1:&lt;/P&gt;&lt;P&gt;If you use &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Let vMaxYear = '=Max({1} Year)';&lt;/P&gt;&lt;P&gt;the variable will get calculated every time you click. But it will also keep its value during the script execution, so you can use it the way you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternative 2:&lt;/P&gt;&lt;P&gt;Calculate vMaxYear from the new data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MaxYear:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Load Max(Year) as MaxYear From &amp;lt;SourceTable&amp;gt; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Let vMaxYear = Peek('&lt;SPAN style="font-size: 13.3333330154419px;"&gt;MaxYear&lt;/SPAN&gt;',-1,'&lt;SPAN style="font-size: 13.3333330154419px;"&gt;MaxYear&lt;/SPAN&gt;');&lt;/P&gt;&lt;P&gt;Now you can use vMaxYear the way you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Mar 2015 14:37:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/question-about-LET-variables/m-p/742669#M1020832</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2015-03-18T14:37:20Z</dc:date>
    </item>
  </channel>
</rss>

