<?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: Call statement issue in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357078#M416381</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your input Marcus.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You do raise a good point with the complication gained by looping the CALL statements since they each will have different variables that are being passed to the SUB routines. This would be a pain to maintanence. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me ask you a question about variables in SUB routines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I write my SUBs to not have any variables being passed in, would the application still know what they are when the SUB routine is being run? For example, if I am loading a file from a specific path, instead of specifying the path in each file we have defined a variable. If I dont include the variable in the SUB parameters, shouldnt the application still know where this file resides?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reason I ask is that alot of my SUBs have If statements to determine if the code should be run and those variables are stored in file that is loaded ahead of this loop. If I just remove the parameters from the call statements suddenly things get easier to code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 10 Jul 2017 15:51:13 GMT</pubDate>
    <dc:creator>cbushey1</dc:creator>
    <dc:date>2017-07-10T15:51:13Z</dc:date>
    <item>
      <title>Call statement issue</title>
      <link>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357071#M416374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am looking for some help with my include/call statements. I have found what I think is a bug but if anyone knows a way around this or perhaps can find a flaw in my method I would appreciate the assistance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to do a loop to load all my script files into the application. Each script file is a SUB routine. &lt;SPAN style="font-size: 10pt;"&gt;The code below will work if I comment out the loop for the Include statements and uncomment the single include statement above the CALL statement so that makes me think there is some issue with loaded SUB routines using a loop.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET vRoot = '..\..\..\..\SQL Script Library';&lt;/P&gt;&lt;P&gt;/* Builds a list of Only Custom scripts in the folder*/&lt;/P&gt;&lt;P&gt;FOR Each File in filelist ('$(vRoot)'&amp;amp;'\*.qvs')&lt;/P&gt;&lt;P&gt;ScriptList:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;SubField('$(File)','\',-1) AS ScriptFullName&lt;/P&gt;&lt;P&gt;, SubField(SubField(SubField('$(File)','\',-1),'_',1),'.',1) AS GenericScriptName&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AUTOGENERATE 1&lt;/P&gt;&lt;P&gt;Where SubField('$(File)','\',-1) like '*_BD*';&lt;/P&gt;&lt;P&gt;next File&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Appends the remaining scripts skipping any generic scripts where custom scripts should be run instead */&lt;/P&gt;&lt;P&gt;FOR Each File in filelist ('$(vRoot)'&amp;amp;'\*.qvs')&lt;/P&gt;&lt;P&gt;Concatenate (ScriptList)&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;SubField('$(File)','\',-1) AS ScriptFullName&lt;/P&gt;&lt;P&gt;, SubField(SubField(SubField('$(File)','\',-1),'_',1),'.',1) AS GenericScriptName&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AUTOGENERATE 1&lt;/P&gt;&lt;P&gt;Where NOT EXISTS(GenericScriptName,SubField(SubField(SubField('$(File)','\',-1),'_',1),'.',1));&lt;/P&gt;&lt;P&gt;next File&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Uses the list of script names created above and loads only those scripts into the application to be called upon. */&lt;/P&gt;&lt;P&gt;For i = 0 to NoOfRows('ScriptList') -1&lt;/P&gt;&lt;P&gt;Let vFileName = Peek('ScriptFullName',$(i),'ScriptList');&lt;/P&gt;&lt;P&gt;$(Include='..\..\..\..\SQL Script Library\'$(vFileName)');&lt;/P&gt;&lt;P&gt;TRACE $(vFileName) Loaded;&lt;/P&gt;&lt;P&gt;Next i&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;///* Clean up variable list */&lt;/P&gt;&lt;P&gt;//SET vRoot = '';&lt;/P&gt;&lt;P&gt;//SET File = '';&lt;/P&gt;&lt;P&gt;//SET i = '';&lt;/P&gt;&lt;P&gt;//SET vFileName = '';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//DROP TABLE ScriptList;&lt;/P&gt;&lt;P&gt;//$(Include='..\..\..\..\SQL Script Library\Eligibility_BD.qvs);&lt;/P&gt;&lt;P&gt;CALL Elig (vIncludeElig,vIncludeEmployer);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Jul 2017 13:12:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357071#M416374</guid>
      <dc:creator>cbushey1</dc:creator>
      <dc:date>2017-07-10T13:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: Call statement issue</title>
      <link>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357072#M416375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is what the ScriptList table looks like when loaded:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Picture1.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/169640_Picture1.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;When you compare the ScriptFullName to what is being loaded with the stand alone Include statement, you see they are the same thing so I am not sure why one works and one doesn't.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also here is the error I get when I trying to run the code the way I had intended (with the loop for the include).&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Call - error.png" class="jive-image image-2" src="/legacyfs/online/169641_Call - error.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Jul 2017 13:34:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357072#M416375</guid>
      <dc:creator>cbushey1</dc:creator>
      <dc:date>2017-07-10T13:34:55Z</dc:date>
    </item>
    <item>
      <title>Re: Call statement issue</title>
      <link>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357073#M416376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can ask yourself what the scope will be of a SUBroutine that is defined only inside a control statement. Will it be known outside of the loop? I don't think so.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A simple example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LET C = 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;FOR i = 1 TO 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; SUB ADD(A, B)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LET C = A + B;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; END SUB&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;NEXT&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;CALL ADD(1, 2);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you run this script, the script engine won't find a definition for SUB ADD, although the SUB statement has been executed at least once. SUBs can be nested or embedded inside other SUBs or control statements, but as soon as that context is destroyed, the SUB definition is lost...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Jul 2017 13:35:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357073#M416376</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2017-07-10T13:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: Call statement issue</title>
      <link>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357074#M416377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Peter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the quick reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What you are saying is the the Sub will only exist as long as the for loop is running and that once it is exited it no longer can be called. When running through this code via debugger, you can see that each file that is included via the include statement gets a new tab and is just waiting to be run (given my code are all Subs otherwise the code would have been run at the time of the include statement). Why then wouldn't these tabs be purged/removed once the loop that created them has completed/exited? After the code gets past the loop and to the call statements, I can still see these tabs with my sub routines waiting to be run.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Jul 2017 13:44:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357074#M416377</guid>
      <dc:creator>cbushey1</dc:creator>
      <dc:date>2017-07-10T13:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: Call statement issue</title>
      <link>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357075#M416378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well (and I didn't test this, sorry) it may be that when you enter the FOR loop again, your SUBs become visible again and you could CALL them allright. But that's not what you intend to do, I guess. Once you leave the scope, the SUB definitions become invisible. While they aren't necessarily dropped and they may still be there somewhere, you simply can't reach them from the point where you'ld like to call them..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Apparently the fact that they are still visible in your debugger, doesn't mean a thing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AFAIK there is only one solution: in the FOR loop, concatenate all script files in a variable but don't execute the SUB definitions. Then after completing the FOR loop, expand the concatenated script block inline at the outer script level so that the SUB definitions are executed and visible to all the code that follows, and issue a series of SUB CALLs in a new FOR loop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Jul 2017 14:43:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357075#M416378</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2017-07-10T14:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: Call statement issue</title>
      <link>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357076#M416379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In general should your approach to load the include-files from a list in a loop be working. Also that all / most of the includes contain sub-routines isn't per se a show-stopper but you will need to be very careful with the order of them and any possible dependencies between them. Like Peter mentioned the scope of the sub-routines is to consider. AFAIK all inside the routine created variables won't be available on the outside - probably there are further more things to be bear in mind.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another point are various syntax-issues by constructing such a complex load-approach, for example I could imagine that you might need different kinds of quotes, dollar-sign expansion and sometimes further adjustements to the variables and parameters, maybe like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL Elig ('$(vIncludeElig)','$(vIncludeEmployer)');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After all I'm not sure that that you will do you a favor with this complicated approach of creating load-scripts. It's quite difficult to develop it and to maintain it will be a nightmare ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Jul 2017 14:55:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357076#M416379</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2017-07-10T14:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: Call statement issue</title>
      <link>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357077#M416380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks again Peter for the reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Interesting idea here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While I dont understand why the subs wouldnt be available outside the loop it would explain why my code worked outside the loop. I was never executing my subs within the loop previously, I just wanted a better way to load them with less coding. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suppose a better option here would be to combine the include and Call statements in the loop. This would eliminate the issue I had been experiencing but given my calls need to be in a specific order I will need to rank my script names so that I run them in the specified order. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you foresee any issue with this approach being done in the DataModel layer of a 3 QVW development setup (generator, Datamodel, visual)? I assume everything after the code has been run should be available outside the loop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Jul 2017 15:01:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357077#M416380</guid>
      <dc:creator>cbushey1</dc:creator>
      <dc:date>2017-07-10T15:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: Call statement issue</title>
      <link>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357078#M416381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your input Marcus.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You do raise a good point with the complication gained by looping the CALL statements since they each will have different variables that are being passed to the SUB routines. This would be a pain to maintanence. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me ask you a question about variables in SUB routines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I write my SUBs to not have any variables being passed in, would the application still know what they are when the SUB routine is being run? For example, if I am loading a file from a specific path, instead of specifying the path in each file we have defined a variable. If I dont include the variable in the SUB parameters, shouldnt the application still know where this file resides?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reason I ask is that alot of my SUBs have If statements to determine if the code should be run and those variables are stored in file that is loaded ahead of this loop. If I just remove the parameters from the call statements suddenly things get easier to code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Jul 2017 15:51:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357078#M416381</guid>
      <dc:creator>cbushey1</dc:creator>
      <dc:date>2017-07-10T15:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: Call statement issue</title>
      <link>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357079#M416382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;An alternative could be to load the content of every script file in a single variable (using a FOR loop), then rearrange the variables (to get the scripts in to the correct order based on some external factor) and then simply expand the variables at the outer level and in sequence. After that you can call the SUBs as you like or wherever you like.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expanding the variables is a no-brainer. Imagine that you can have a maximum of 26 external script files, and at the moment you only have 5. Then the following series will expand whatever you have. Empty/Non-existent variables (starting from Var 6 after the FOR loop stopped executing at cycle 6) won't cause any problems.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;$(vScriptExpansionA)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'courier new', courier;"&gt;$(vScriptExpansionB)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'courier new', courier;"&gt;$(vScriptExpansionC)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'courier new', courier;"&gt;$(vScriptExpansionD)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'courier new', courier;"&gt;$(vScriptExpansionE)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'courier new', courier;"&gt;$(vScriptExpansionF)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'courier new', courier;"&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'courier new', courier;"&gt;$(vScriptExpansionZ)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;If you are careful, I don't think this will cause any problems in a Server Architecture with different stages. On condition that you execute the series of scripts in the exact same way every time. And be careful to check the scope and visibility of all variables you need to be available at the outer level.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Jul 2017 16:02:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357079#M416382</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2017-07-10T16:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: Call statement issue</title>
      <link>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357080#M416383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Most of my script-variables mainly paths and filetypes and similar stuff are loaded at very first point in the script with multiple include-statements within a tab "prepare" and therefore they are global everywhere until the script finished and another include-statements dropped all those variables again. This minimized the need to pass many variables within the routines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually I don't use many of the sub-routines for loading anything - earlier I did a lot of such stuff to create load-scripts on the fly. I think some of them were really nice from a pure coding point of view but they was too complicated for a production environment where things must be just simply and stable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Jul 2017 16:31:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357080#M416383</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2017-07-10T16:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Call statement issue</title>
      <link>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357081#M416384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Small piece of experience that's worth a ton...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jul 2017 07:02:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357081#M416384</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2017-07-11T07:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: Call statement issue</title>
      <link>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357082#M416385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you both Peter and Marcus for offering your thoughts on this thread. It is much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have entered into a support case to discuss the functionality of the loop and why the sub routines wouldn't be available after the loop has run.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the interim, I have worked on improving my loop to have both the include and the call statements and also improved my sub routines to not include the variables as parameters since they were defined previously as global variables via a script file. Given that my scripts need to run in a specific order, I will have be including a way to rank and sort the scripts according to a predefined ranking.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will close the post as it appears the issue has been identified, issue with looping include statements. !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jul 2017 13:37:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357082#M416385</guid>
      <dc:creator>cbushey1</dc:creator>
      <dc:date>2017-07-11T13:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: Call statement issue</title>
      <link>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357083#M416386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's getting even worse &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/confused.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Apparently, an IF statement also creates a new lexical level (of a type that is commonly called "Block"). If you define a SUB in an IF block, the SUB will only be visible inside the IF and all nested blocks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After this reversal of IF-fortune, it took me a while to find a method to test whether a SUB definition survives into the next FOR cycle. But then I got it: &lt;EM&gt;the magic of $-sign substitution to the rescue again !&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following proves that a SUB definition stays alive inside the FOR loop. Not that it has any use that I know of...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LET C = 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LET vSub = '&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;SUB ADD(A, B)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LET C = A + B;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;END SUB&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;FOR i = 1 TO 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; $(vSub)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LET vSub = 'CALL ADD(1, 2);';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;NEXT&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It may not be the outcome we would have liked, but at least I learned a thing or two &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS Older init systems in Unix/Linux-land had the same issue with differently named scripts needing an implicit order of execution indicator. If I'm not mistaken, the designers resorted to adding a numerical two digit prefix to all file names that was used to sort the list of script files. Maybe that could be of help?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jul 2017 14:33:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357083#M416386</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2017-07-11T14:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: Call statement issue</title>
      <link>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357084#M416387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glad to see I wasn't the only one struggling with this issue and glad there are some work arounds to it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My solution I am testing now but given I didnt want to go down the route of assigning all my include statements into a single variable and having multiple call statements as I eventually wanted to loop the call statements, I have included both the include and call in the same loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will certainly keep this thread in mind for the future and when I am done testing my code I will post so you can see the solution I went with.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jul 2017 15:12:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Call-statement-issue/m-p/1357084#M416387</guid>
      <dc:creator>cbushey1</dc:creator>
      <dc:date>2017-07-11T15:12:11Z</dc:date>
    </item>
  </channel>
</rss>

