<?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 Passing variable to subroutine in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Passing-variable-to-subroutine/m-p/720974#M670877</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;this is actually in consequence of another post of mine - but it's a different issue now and here like everywhere else I like to split things into smaller pieces, then it doesn't get too confusing and it's easier for people to realize whether they can help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&amp;gt; I have a large meta_loop across six sheets of an Excel_workbook. It passes a parameter "v_Liste_aktuell" like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt;&amp;nbsp; &lt;STRONG&gt;CALL &lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Sofareinigung&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; (&lt;/SPAN&gt;&lt;EM style=": ; color: #808080; font-size: 8pt;"&gt;$(v_Liste_aktuell)&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&amp;nbsp; &amp;lt;&amp;lt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;=&amp;gt; I want to use this variable in the subroutine, so I have to specify it in the &amp;gt;sub&amp;lt; statement at the top of it all, no?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp; =&amp;gt; I do that &amp;gt;&amp;gt;&amp;nbsp; sub &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;Sofareinigung&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; (&lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;v_list&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;)&amp;nbsp; &amp;lt;&amp;lt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&amp;gt; So within the subroutine, there should now be a variable &amp;gt; v_list &amp;lt; that has the same value as the one I passed in the CALL, yes? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;What I find very confusing: It seems - as seen in the Debugger - that QlikView creates a variable with the exact name of the current list - what is in the variable "v_Liste_aktuell" - and that has a NULL value. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;The variable &amp;gt; v_list &amp;lt; that I specify in that statement is NOT created - and consequently, the very first step in the entire code - a LOAD from an Excel_file - is wacky because I cannot specify which sheet of the table is supposed to be loaded.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Can someone help me here?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Thanks a lot!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;DataNibbler&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Oct 2014 09:18:31 GMT</pubDate>
    <dc:creator>datanibbler</dc:creator>
    <dc:date>2014-10-14T09:18:31Z</dc:date>
    <item>
      <title>Passing variable to subroutine</title>
      <link>https://community.qlik.com/t5/QlikView/Passing-variable-to-subroutine/m-p/720974#M670877</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;this is actually in consequence of another post of mine - but it's a different issue now and here like everywhere else I like to split things into smaller pieces, then it doesn't get too confusing and it's easier for people to realize whether they can help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&amp;gt; I have a large meta_loop across six sheets of an Excel_workbook. It passes a parameter "v_Liste_aktuell" like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt;&amp;nbsp; &lt;STRONG&gt;CALL &lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Sofareinigung&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; (&lt;/SPAN&gt;&lt;EM style=": ; color: #808080; font-size: 8pt;"&gt;$(v_Liste_aktuell)&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&amp;nbsp; &amp;lt;&amp;lt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;=&amp;gt; I want to use this variable in the subroutine, so I have to specify it in the &amp;gt;sub&amp;lt; statement at the top of it all, no?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp; =&amp;gt; I do that &amp;gt;&amp;gt;&amp;nbsp; sub &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;Sofareinigung&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; (&lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;v_list&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;)&amp;nbsp; &amp;lt;&amp;lt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&amp;gt; So within the subroutine, there should now be a variable &amp;gt; v_list &amp;lt; that has the same value as the one I passed in the CALL, yes? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;What I find very confusing: It seems - as seen in the Debugger - that QlikView creates a variable with the exact name of the current list - what is in the variable "v_Liste_aktuell" - and that has a NULL value. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;The variable &amp;gt; v_list &amp;lt; that I specify in that statement is NOT created - and consequently, the very first step in the entire code - a LOAD from an Excel_file - is wacky because I cannot specify which sheet of the table is supposed to be loaded.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Can someone help me here?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Thanks a lot!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;DataNibbler&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Oct 2014 09:18:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Passing-variable-to-subroutine/m-p/720974#M670877</guid>
      <dc:creator>datanibbler</dc:creator>
      <dc:date>2014-10-14T09:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: Passing variable to subroutine</title>
      <link>https://community.qlik.com/t5/QlikView/Passing-variable-to-subroutine/m-p/720975#M670879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I have it - the variable has to be written without the $ in the CALL_statement and taken over by the subroutine with the $ - very confusing ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Oct 2014 09:28:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Passing-variable-to-subroutine/m-p/720975#M670879</guid>
      <dc:creator>datanibbler</dc:creator>
      <dc:date>2014-10-14T09:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: Passing variable to subroutine</title>
      <link>https://community.qlik.com/t5/QlikView/Passing-variable-to-subroutine/m-p/720976#M670880</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;Try like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET Str1 = 'abcdef';&lt;/P&gt;&lt;P&gt;SET Str2 = 'abcefg';&lt;/P&gt;&lt;P&gt;LET test = CommonStringLength((Str1), (Str2));&amp;nbsp;&amp;nbsp; -- CommonStringLength is a macro function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Macro code:&lt;/P&gt;&lt;P&gt;function CommonStringLength(Str1, Str2)&lt;/P&gt;&lt;P&gt;&amp;nbsp; strLength = Max(Len(Str1), Len(Str2))&lt;/P&gt;&lt;P&gt;&amp;nbsp; For i=1 To strLength&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Mid(Str1,i,1) &amp;lt;&amp;gt; Mid(Str2,i,1) then&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CommonStringLength = i-1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit for&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If i = strLength then CommonStringLength = strLength&lt;/P&gt;&lt;P&gt;&amp;nbsp; Next&lt;/P&gt;&lt;P&gt;end function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Oct 2014 09:38:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Passing-variable-to-subroutine/m-p/720976#M670880</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2014-10-14T09:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Passing variable to subroutine</title>
      <link>https://community.qlik.com/t5/QlikView/Passing-variable-to-subroutine/m-p/720977#M670881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi jagan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for helping! But I think I have it now.&lt;/P&gt;&lt;P&gt;I didn't think of this because to my knowledge, whenever a variable contains alphanumeric digits, you needed that $-expansion - so I used it in the CALL_statement, too - but there it seems this is not allowed without regard of the variable_contents.&lt;/P&gt;&lt;P&gt;Now the variable is properly passed to the subroutine.&lt;/P&gt;&lt;P&gt;All should be well now - except in the longer run there won't be one workbook with six sheets to load, but six workbooks - the lists have to be exported manually because we will not get access to that tool for automatization, so I will try to keep that effort to the absolute minimum and work with whatever comes out of that tool.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Oct 2014 09:47:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Passing-variable-to-subroutine/m-p/720977#M670881</guid>
      <dc:creator>datanibbler</dc:creator>
      <dc:date>2014-10-14T09:47:42Z</dc:date>
    </item>
  </channel>
</rss>

