<?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: What is this script? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/What-is-this-script/m-p/839348#M997313</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is a reusable piece of code (A Sub Routine) that you can call as many times as you need&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN style="color: #000000;"&gt;SUB LoadQVD (Tablename)&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp;&amp;nbsp; $(Tablename):&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #006699;"&gt;&lt;SPAN class="keyword"&gt;Load&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; * &lt;/SPAN&gt;&lt;SPAN style="color: #006699;"&gt;&lt;SPAN class="keyword"&gt;from&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; [$(Path)$(Tablename).qvd] (Qvd);&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: #006699;"&gt;&lt;SPAN class="keyword"&gt;END&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; SUB&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN style="color: #000000;"&gt;LoadQVD &lt;/SPAN&gt;: this is the name of the subroutine that has a parameter (&lt;SPAN style="color: #000000;"&gt;Tablename&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;if you write in your code &lt;SPAN style="color: #000000;"&gt;LoadQVD(My&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;Table) you will have a table with the name &lt;SPAN style="color: #000000;"&gt;My&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;Table&lt;/SPAN&gt; that loads data from&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;a qvd file&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Jun 2015 07:58:29 GMT</pubDate>
    <dc:creator>alexandros17</dc:creator>
    <dc:date>2015-06-17T07:58:29Z</dc:date>
    <item>
      <title>What is this script?</title>
      <link>https://community.qlik.com/t5/QlikView/What-is-this-script/m-p/839347#M997312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Folks,&lt;/P&gt;&lt;P&gt;What is this script? When we use this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please explain. Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14345276324231998 jive_text_macro" jivemacro_uid="_14345276324231998"&gt;
&lt;P&gt;SUB LoadQVD (Tablename)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; $(Tablename):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; Load * from [$(Path)$(Tablename).qvd] (Qvd);&lt;/P&gt;
&lt;P&gt;END SUB&lt;/P&gt;

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Nov 2020 18:02:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/What-is-this-script/m-p/839347#M997312</guid>
      <dc:creator>qlikviewwizard</dc:creator>
      <dc:date>2020-11-20T18:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: What is this script?</title>
      <link>https://community.qlik.com/t5/QlikView/What-is-this-script/m-p/839348#M997313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is a reusable piece of code (A Sub Routine) that you can call as many times as you need&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN style="color: #000000;"&gt;SUB LoadQVD (Tablename)&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp;&amp;nbsp; $(Tablename):&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #006699;"&gt;&lt;SPAN class="keyword"&gt;Load&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; * &lt;/SPAN&gt;&lt;SPAN style="color: #006699;"&gt;&lt;SPAN class="keyword"&gt;from&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; [$(Path)$(Tablename).qvd] (Qvd);&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: #006699;"&gt;&lt;SPAN class="keyword"&gt;END&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; SUB&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN style="color: #000000;"&gt;LoadQVD &lt;/SPAN&gt;: this is the name of the subroutine that has a parameter (&lt;SPAN style="color: #000000;"&gt;Tablename&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;if you write in your code &lt;SPAN style="color: #000000;"&gt;LoadQVD(My&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;Table) you will have a table with the name &lt;SPAN style="color: #000000;"&gt;My&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;Table&lt;/SPAN&gt; that loads data from&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;a qvd file&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2015 07:58:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/What-is-this-script/m-p/839348#M997313</guid>
      <dc:creator>alexandros17</dc:creator>
      <dc:date>2015-06-17T07:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: What is this script?</title>
      <link>https://community.qlik.com/t5/QlikView/What-is-this-script/m-p/839349#M997314</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hope this helps you :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The &lt;SPAN class="Bold"&gt;sub..end sub&lt;/SPAN&gt; control statement defines a subroutine which can be called upon from a &lt;SPAN class="Bold"&gt;call&lt;/SPAN&gt; statement. &lt;/P&gt;&lt;P&gt;The syntax is:&lt;/P&gt;&lt;P class="syntax"&gt;&lt;SPAN class="Bold"&gt;sub &lt;/SPAN&gt;&lt;SPAN class="Italic"&gt;name [ &lt;SPAN class="Bold"&gt;(&lt;/SPAN&gt; paramlist &lt;SPAN class="Bold"&gt;)&lt;/SPAN&gt;] statements &lt;/SPAN&gt;&lt;SPAN class="Bold"&gt;end sub&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;Where:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN class="Italic"&gt;name&lt;/SPAN&gt; &lt;/TD&gt;&lt;TD&gt;is the name of the subroutine. &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN class="Italic"&gt;paramlist&lt;/SPAN&gt; &lt;/TD&gt;&lt;TD&gt;is a comma separated list of variable names for the formal parameters of the subroutine. These can be used as any variable inside the subroutine.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN class="Italic"&gt;statements&lt;/SPAN&gt; &lt;/TD&gt;&lt;TD&gt;is any group of one or more QlikView script statements. &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Arguments are copied into the subroutine and, if the corresponding actual parameters in the &lt;SPAN class="Bold"&gt;call&lt;/SPAN&gt; statement is a variable name, copied back out again upon exiting the subroutine. &lt;/P&gt;&lt;P&gt;If a subroutine has more formal parameters than actual parameters passed by a &lt;SPAN class="Bold"&gt;call&lt;/SPAN&gt; statement, the extra parameters will be initialized to NULL and can be used as local variables within the subroutine. &lt;/P&gt;&lt;P&gt;Since the &lt;SPAN class="Bold"&gt;sub&lt;/SPAN&gt; statement is a control statement and as such is ended with either a semicolon or end-of-line, each of its two clauses (&lt;SPAN class="Bold"&gt;sub&lt;/SPAN&gt; and &lt;SPAN class="Bold"&gt;end sub&lt;/SPAN&gt;) must not cross a line boundary. &lt;/P&gt;&lt;P&gt;If the sub statement is defined inside another control statement, for example a &lt;A&gt;For … Next&lt;/A&gt; loop or an &lt;A&gt;If … Then&lt;/A&gt; construction, the subroutine is only available inside the scope of that control statement. In other words: the sub statement cannot be defined inside another control statement if the subroutine call should be made from outside the control statement. This is also true if the subroutine is defined in a script file included using the &lt;A&gt;include&lt;/A&gt; system variable within a control statement.&lt;/P&gt;&lt;P class="example"&gt;Examples:&lt;/P&gt;&lt;P class="Code"&gt;// Example 1&lt;/P&gt;&lt;P class="Code"&gt;sub INCR (I,J)&lt;/P&gt;&lt;P class="Code"&gt;I = I + 1&lt;/P&gt;&lt;P class="Code"&gt;exit sub when I &amp;lt; 10&lt;/P&gt;&lt;P class="Code"&gt;J = J + 1&lt;/P&gt;&lt;P class="Code"&gt;end sub&lt;/P&gt;&lt;P class="Code"&gt;call INCR (X,Y)&lt;/P&gt;&lt;P class="Code"&gt;&lt;/P&gt;&lt;P class="Code"&gt;// Example 2 - parameter transfer&lt;/P&gt;&lt;P class="Code"&gt;sub ParTrans (A,B,C)&lt;/P&gt;&lt;P class="Code"&gt;A=A+1&lt;/P&gt;&lt;P class="Code"&gt;B=B+1&lt;/P&gt;&lt;P class="Code"&gt;C=C+1&lt;/P&gt;&lt;P class="Code"&gt;end sub&lt;/P&gt;&lt;P class="Code"&gt;A=1&lt;/P&gt;&lt;P class="Code"&gt;X=1&lt;/P&gt;&lt;P class="Code"&gt;C=1&lt;/P&gt;&lt;P class="Code"&gt;call ParTrans (A, (X+1)*2)&lt;/P&gt;&lt;P&gt;The result of the above will be that locally, inside the subroutine, A will be initialized to 1, B will be initialized to 4 and C will be initialized to NULL.&lt;/P&gt;&lt;P&gt;When exiting the subroutine, the global variable A will get 2 as value (copied back from subroutine). The second actual parameter “(X+1)*2” will not be copied back since it is not a variable. Finally, the global variable C will not be affected by the subroutine call.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2015 08:01:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/What-is-this-script/m-p/839349#M997314</guid>
      <dc:creator>avinashelite</dc:creator>
      <dc:date>2015-06-17T08:01:08Z</dc:date>
    </item>
  </channel>
</rss>

