<?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: Can anyone explain how this Variables script works please? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Can-anyone-explain-how-this-Variables-script-works-please/m-p/990905#M644538</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;because the row count starts from 1 and the &lt;/P&gt;&lt;P&gt;variable i starts from 0&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 26 Nov 2015 15:12:58 GMT</pubDate>
    <dc:creator>lironbaram</dc:creator>
    <dc:date>2015-11-26T15:12:58Z</dc:date>
    <item>
      <title>Can anyone explain how this Variables script works please?</title>
      <link>https://community.qlik.com/t5/QlikView/Can-anyone-explain-how-this-Variables-script-works-please/m-p/990901#M644534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;Below is a script I found on the internet to load variables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//====================================================================================================&lt;/P&gt;&lt;P&gt;// COMMON VARIABLES LOAD SCRIPT&lt;/P&gt;&lt;P&gt;// &lt;/P&gt;&lt;P&gt;// Sample script to load the common variables into the application.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;// You may wish to store these in Excel (as was done here) or in a database or flat file. It won't &lt;/P&gt;&lt;P&gt;// impact the usage of the variables.&amp;nbsp;&amp;nbsp; Once they are read into the application here they are then &lt;/P&gt;&lt;P&gt;// created as document variables for this application with the second section of code below.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;//====================================================================================================&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CommonVariables:&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VariableName, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VariableValue&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;[Variables.xlsx]&lt;/P&gt;&lt;P&gt;(ooxml, embedded labels, table is Sheet1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// ---------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;// This code converts the variables from table values to document variables&lt;/P&gt;&lt;P&gt;// ---------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Let RowCount = NumMax(NoOfRows('CommonVariables'),0)-1;&lt;/P&gt;&lt;P&gt;For i=0 to '$(RowCount)'&lt;/P&gt;&lt;P&gt;&amp;nbsp; Let TempVarName = peek('VariableName',$(i),'CommonVariables');&lt;/P&gt;&lt;P&gt;&amp;nbsp; Let TempVarValue = peek('VariableValue',$(i),'CommonVariables');&lt;/P&gt;&lt;P&gt;&amp;nbsp; Let $(TempVarName) = '$(TempVarValue)';&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// -------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;// You can drop the CommonVariables table if you don't want to use it for display in the app&lt;/P&gt;&lt;P&gt;// -------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;DROP TABLE CommonVariables;&lt;/P&gt;&lt;P&gt;//------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ths script above works but I do not understand how the variables are stored as Document Variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What part of the For Next loop does that? How does QlikView know that it needs to store this as Document Variables?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Nov 2015 14:39:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-anyone-explain-how-this-Variables-script-works-please/m-p/990901#M644534</guid>
      <dc:creator>jblomqvist</dc:creator>
      <dc:date>2015-11-26T14:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: Can anyone explain how this Variables script works please?</title>
      <link>https://community.qlik.com/t5/QlikView/Can-anyone-explain-how-this-Variables-script-works-please/m-p/990902#M644535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;For i=0 to '$(RowCount)'&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; Let TempVarName = peek('VariableName',$(i),'CommonVariables'); - this row assign the desired name for the variable to &lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; temporary variable&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; Let TempVarValue = peek('VariableValue',$(i),'CommonVariables'); - this row assign the desired value for the variable to&amp;nbsp; temporary variable&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; Let $(TempVarName) = '$(TempVarValue)';- this row creates the variable with the parameters from the previous rows&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Next&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;in general a LET\SET Statement means you are creating a variable &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Nov 2015 14:46:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-anyone-explain-how-this-Variables-script-works-please/m-p/990902#M644535</guid>
      <dc:creator>lironbaram</dc:creator>
      <dc:date>2015-11-26T14:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: Can anyone explain how this Variables script works please?</title>
      <link>https://community.qlik.com/t5/QlikView/Can-anyone-explain-how-this-Variables-script-works-please/m-p/990903#M644536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Liron,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks. Why do we need a -1 at the end of Let RowCount statement?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Nov 2015 15:10:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-anyone-explain-how-this-Variables-script-works-please/m-p/990903#M644536</guid>
      <dc:creator>jblomqvist</dc:creator>
      <dc:date>2015-11-26T15:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Can anyone explain how this Variables script works please?</title>
      <link>https://community.qlik.com/t5/QlikView/Can-anyone-explain-how-this-Variables-script-works-please/m-p/990904#M644537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Because peeks run from 0 to RowCount-1 (peek() index is 0-based). Otherwise you'll run past the end of the table...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Nov 2015 15:12:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-anyone-explain-how-this-Variables-script-works-please/m-p/990904#M644537</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2015-11-26T15:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: Can anyone explain how this Variables script works please?</title>
      <link>https://community.qlik.com/t5/QlikView/Can-anyone-explain-how-this-Variables-script-works-please/m-p/990905#M644538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;because the row count starts from 1 and the &lt;/P&gt;&lt;P&gt;variable i starts from 0&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Nov 2015 15:12:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-anyone-explain-how-this-Variables-script-works-please/m-p/990905#M644538</guid>
      <dc:creator>lironbaram</dc:creator>
      <dc:date>2015-11-26T15:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: Can anyone explain how this Variables script works please?</title>
      <link>https://community.qlik.com/t5/QlikView/Can-anyone-explain-how-this-Variables-script-works-please/m-p/990906#M644539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See a similar discussion here: &lt;A href="https://community.qlik.com/thread/192741"&gt;variables evalution confusion?&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Nov 2015 15:14:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-anyone-explain-how-this-Variables-script-works-please/m-p/990906#M644539</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2015-11-26T15:14:27Z</dc:date>
    </item>
  </channel>
</rss>

