<?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: Variables in Load Script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Variables-in-Load-Script/m-p/581515#M479163</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is no need to edit the script each month.&amp;nbsp; The current date is always known, so you can calculate the start date of the data you need - it could be "three months back" or "the start of the month three months back", or whatever rule you can think of.&amp;nbsp; Create a variable according to your rule at the beginning of the script and use it later in the script as a condition to filter the records.&lt;/P&gt;&lt;P&gt;A good habit is to delete this variable at the end of the script if you don't need it on the front end.&amp;nbsp; Or vote here &lt;A _jive_internal="true" href="https://community.qlik.com/ideas/1909"&gt;http://community.qlik.com/ideas/1909&lt;/A&gt; for Rob's idea.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 13 Feb 2014 15:25:18 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2014-02-13T15:25:18Z</dc:date>
    <item>
      <title>Variables in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-Load-Script/m-p/581509#M479157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was wondering if it's possible to use variables in the load script and either prompt the user for input, or pull the values from an object in the application like a date picker.&amp;nbsp; The reason for this is that I'm using some SQL to pull three consecutive months worth of data from a database.&amp;nbsp; I'm usually pulling for the last three months.&amp;nbsp; I would like to be able to change which months are loaded without manually editing the load script each month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;-Nate&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Feb 2014 14:18:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-Load-Script/m-p/581509#M479157</guid>
      <dc:creator>dukane24</dc:creator>
      <dc:date>2014-02-13T14:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-Load-Script/m-p/581510#M479158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes you can use variables inside the script&lt;/P&gt;&lt;P&gt;do sth like $(myVar)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No, you cannot ask the user during the script&lt;/P&gt;&lt;P&gt;Yes, can link this variable to a QV object; like InputBox or Slider for example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because your script must be OK in all cases, either use the alt() function in case your variable is null (to set a default) or exit the script&lt;/P&gt;&lt;P&gt;sth like:&lt;/P&gt;&lt;P&gt;let myVar = alt(myVar, 3)&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;if isnull(myVar) ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you run batch, you may also set this variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had published a long doc on LOAD. You will find more explanations into it&lt;/P&gt;&lt;P&gt;: &lt;A href="http://community.qlik.com/docs/DOC-5698"&gt;http://community.qlik.com/docs/DOC-5698&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fabrice&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Feb 2014 14:29:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-Load-Script/m-p/581510#M479158</guid>
      <dc:creator />
      <dc:date>2014-02-13T14:29:35Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-Load-Script/m-p/581511#M479159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you can use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- an external file as Fabrice said&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- an input box UI object linked to a variable&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- this function in the script &lt;/P&gt;&lt;P class="syntax"&gt;&lt;A name="kanchor1328"&gt;&lt;/A&gt;&lt;A name="input("&gt;&lt;/A&gt;&lt;SPAN class="Bold"&gt;Input(&lt;/SPAN&gt;&lt;SPAN class="Italic"&gt;str cue [, str caption]&lt;/SPAN&gt;&lt;SPAN class="Bold"&gt;)&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;This function can be used in the script only and opens an input box that prompts the user for a value during the script execution. The parameters cue and caption are used as message and caption texts, respectively. The function returns the entered value. &lt;/P&gt;&lt;P&gt;The input box function returns NULL if the dialog is cancelled, closed or cannot be shown. &lt;/P&gt;&lt;P class="example"&gt;Example:&lt;/P&gt;&lt;P class="Code"&gt;Load &lt;BR /&gt;Input('Enter value', 'Input box') as v, &lt;BR /&gt;Recno () as r &lt;BR /&gt;autogenerate 3; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Feb 2014 14:34:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-Load-Script/m-p/581511#M479159</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2014-02-13T14:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-Load-Script/m-p/581512#M479160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;No, you cannot ask the user during the script&lt;/SPAN&gt;"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the input() script function to prompt for user input. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Feb 2014 14:36:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-Load-Script/m-p/581512#M479160</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2014-02-13T14:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-Load-Script/m-p/581513#M479161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are absolutely right&lt;/P&gt;&lt;P&gt;You can also use &lt;STRONG&gt;Input&lt;/STRONG&gt;() function. Test in case the user presses Cancel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for that (in fact, i do not know why, I never used it)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fabrice&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Feb 2014 14:49:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-Load-Script/m-p/581513#M479161</guid>
      <dc:creator />
      <dc:date>2014-02-13T14:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-Load-Script/m-p/581514#M479162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I guess you don't use it for the same reason as most of us - you want to run unattended reload.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Feb 2014 15:19:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-Load-Script/m-p/581514#M479162</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-02-13T15:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-Load-Script/m-p/581515#M479163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is no need to edit the script each month.&amp;nbsp; The current date is always known, so you can calculate the start date of the data you need - it could be "three months back" or "the start of the month three months back", or whatever rule you can think of.&amp;nbsp; Create a variable according to your rule at the beginning of the script and use it later in the script as a condition to filter the records.&lt;/P&gt;&lt;P&gt;A good habit is to delete this variable at the end of the script if you don't need it on the front end.&amp;nbsp; Or vote here &lt;A _jive_internal="true" href="https://community.qlik.com/ideas/1909"&gt;http://community.qlik.com/ideas/1909&lt;/A&gt; for Rob's idea.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Feb 2014 15:25:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-Load-Script/m-p/581515#M479163</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-02-13T15:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-Load-Script/m-p/581516#M479164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Either the scope is knwon (95 % of the scripts) and no use to ask. As you said, it may be computed (the last 3 months for ex ending today or yesterday ...)&lt;/P&gt;&lt;P&gt;Or the user may chose its scope (I guess 5%). To me, it is easier in the UI to give the choice, to check the input (the min, the max, the data type ...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The user can enter numeric or text&amp;nbsp; in the input box. He may press Cancel (variable becomes null) .... Many many tests to be sure that the input is as expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fabrice&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Feb 2014 15:39:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-Load-Script/m-p/581516#M479164</guid>
      <dc:creator />
      <dc:date>2014-02-13T15:39:51Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-Load-Script/m-p/581517#M479165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nate,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a different approach, but it might help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use an external file to store your variable. You can set your variables in a fil such as "variables.qvs".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the file define your variables. For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SET vMonthStart = 1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SET vMonthEnd = Month(Today());&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On your load script use an Include sentence, like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;SPAN lang="EN-US" style="color: gray; font-family: 'Courier New'; font-size: 9pt; mso-ansi-language: EN-US;"&gt;$(Include=&amp;lt;file path&amp;gt;variables.qvs)&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="color: black; font-family: 'Courier New'; font-size: 9pt; mso-ansi-language: EN-US;"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="color: black; font-family: 'Courier New'; font-size: 9pt; mso-ansi-language: EN-US;"&gt;After including the variables, use them on your script.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="color: black; font-family: 'Courier New'; font-size: 9pt; mso-ansi-language: EN-US;"&gt;Should you need to select a different period of time, you will only have&lt;BR /&gt;to change the variable values on your file (instead of altering the load script).&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Feb 2014 16:13:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-Load-Script/m-p/581517#M479165</guid>
      <dc:creator />
      <dc:date>2014-02-13T16:13:45Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-Load-Script/m-p/581518#M479166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mostly agree.&lt;/P&gt;&lt;P&gt;I didn't use input in the script besides some basic testing, and don't remember the details.&amp;nbsp; I'm thinking now that there could be (if not - should be!) an option for the unattended reload.&amp;nbsp; Say, if there is no user input for some reasonable time, use something else defined in the script as a default value.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Feb 2014 16:51:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-Load-Script/m-p/581518#M479166</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-02-13T16:51:52Z</dc:date>
    </item>
  </channel>
</rss>

