<?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: Cleanup in script - set variables to NULL in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751378#M662177</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From a performance point of view there will be none big difference between set v =; or let v = null(); I think the engine will be able to execute thousands from such statements within a second .... maybe by one a few more ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Mar 2015 06:03:07 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2015-03-17T06:03:07Z</dc:date>
    <item>
      <title>Cleanup in script - set variables to NULL</title>
      <link>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751369#M662162</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;in principle I am already doing this: Every variable that is being used in a script is afterwards set to NULL so that I won't eventually end up with obsolete variables that can cause confusion in an app.&lt;/P&gt;&lt;P&gt;I have now a piece of code that loads an Excel_file with the two logons of the developers we have and creates out of those a visibility_condition like&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt; OSUSER() = 'SYNCREON\name.surname OR OSUSER() = 'SYNCREON\name2.surname2'&amp;nbsp; &amp;lt;&amp;lt;&lt;/P&gt;&lt;P&gt;Pretty complex stuff. It's basically all being done in a loop which I will post here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The challenge is: I already do set the variables to NULL, but I still have the evaluations of the variables left when I run that.&lt;/P&gt;&lt;P&gt;=&amp;gt; How can I set those to NULL?&lt;/P&gt;&lt;P&gt;(&amp;nbsp; &amp;gt;&amp;gt; &lt;STRONG&gt;SET $(varname) =&lt;/STRONG&gt; ; &amp;lt;&amp;lt;&amp;nbsp; (inside the loop) doesn't work, that would be easy ... )&lt;/P&gt;&lt;P&gt;This is the loop (the Excel_file is attached)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR i = 1 TO $(v_admins) // that is the nr. of rows&lt;BR /&gt;&amp;nbsp; LET varname = 'v_admin' &amp;amp; $(i);&lt;BR /&gt;&amp;nbsp; LET $(varname) = PEEK('OSU', ($(i)-1), Developers_pre); //Developers_pre is the table that I first get when I load the file&lt;BR /&gt;&amp;nbsp; LET varname2 = 'e_admins_only_part' &amp;amp; $(i);&lt;BR /&gt;&amp;nbsp; LET $(varname2) = 'OSUSER() = ' &amp;amp; $(varname);&lt;BR /&gt;// I have exclamation_marks around the individual elements here to avoid confusion with upper_quotes (they are replaced lateron)&lt;/P&gt;&lt;P&gt;&amp;nbsp; LET e_admins_only = '$(e_admins_only)' &amp;amp; ' OR OSUSER() = ' &amp;amp; chr(33) &amp;amp; $(varname) &amp;amp; chr(33);&lt;BR /&gt;// The variables are now all deleted (set to NULL)&lt;/P&gt;&lt;P&gt;&amp;nbsp; SET varname2 = ;&lt;BR /&gt;&amp;nbsp; SET varname = ;&lt;BR /&gt;NEXT i;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anybody help me here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DataNibbler&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Feb 2015 13:06:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751369#M662162</guid>
      <dc:creator>datanibbler</dc:creator>
      <dc:date>2015-02-05T13:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: Cleanup in script - set variables to NULL</title>
      <link>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751370#M662165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi DataNibbler,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure if this approach would work but you could try it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create within your loop a delete-statement for these unwanted created variable:&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;Let vDeletevariable = 'LET ' &amp;amp; YourVariableValue &amp;amp; '= null();';&lt;/P&gt;&lt;P&gt;$(vDeletevariable)&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Maybe this link is a kind of explanation: &lt;/SPAN&gt;&lt;A class="jive-link-message-small" data-containerid="1100" data-containertype="700" data-objectid="176351" data-objecttype="2" href="http://community.qlik.com/message/176351#176351"&gt;http://community.qlik.com/message/176351#176351&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Feb 2015 13:32:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751370#M662165</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2015-02-05T13:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: Cleanup in script - set variables to NULL</title>
      <link>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751371#M662169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I cannot open that link, I am not authorized, for whatever reason.&lt;/P&gt;&lt;P&gt;I will try your proposal. Looks good.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Feb 2015 13:35:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751371#M662169</guid>
      <dc:creator>datanibbler</dc:creator>
      <dc:date>2015-02-05T13:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: Cleanup in script - set variables to NULL</title>
      <link>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751372#M662171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;... and it works. The editor apparently doesn't know it, the statement is underlined (at least in my outdated version of the Client), but it runs and works - the variable is apparently gone.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DataNibbler&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Feb 2015 13:38:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751372#M662171</guid>
      <dc:creator>datanibbler</dc:creator>
      <dc:date>2015-02-05T13:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: Cleanup in script - set variables to NULL</title>
      <link>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751373#M662172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi DataNibbler,&lt;/P&gt;&lt;P&gt;The link Marcus posted is to a post in the QlikBug group.&lt;/P&gt;&lt;P&gt;Click Places on the toolbar and you can join the group from the list.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Feb 2015 13:39:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751373#M662172</guid>
      <dc:creator>Colin-Albert</dc:creator>
      <dc:date>2015-02-05T13:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: Cleanup in script - set variables to NULL</title>
      <link>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751374#M662173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Data,&lt;/P&gt;&lt;P&gt;I know&lt;/P&gt;&lt;P&gt;SET $(varname) = ;&lt;/P&gt;&lt;P&gt;won't work for you but&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET v_admin$(i) =;&lt;/P&gt;&lt;P&gt;SET e_admins_only_part$(i)=;&lt;/P&gt;&lt;P&gt;should do I think. Maybe give that a try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope that helps&lt;/P&gt;&lt;P&gt;Joe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Feb 2015 13:49:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751374#M662173</guid>
      <dc:creator />
      <dc:date>2015-02-05T13:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: Cleanup in script - set variables to NULL</title>
      <link>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751375#M662174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I see thats there's already an answer, but I have a simple remark to your script. You are using "SET varname2 = ;"&lt;/P&gt;&lt;P&gt;I clean all my variables by "LET varname2 = NULL();". With that it doesn't appear in the Variable Overview. So if you have the same varname you can simply use this. The solution of Marcus Sommer &lt;SPAN class="font-color-meta j-line2"&gt;&lt;/SPAN&gt;is more sophisticated or comes this from the Bug-Thread?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards &lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Feb 2015 13:49:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751375#M662174</guid>
      <dc:creator>peterwh</dc:creator>
      <dc:date>2015-02-05T13:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: Cleanup in script - set variables to NULL</title>
      <link>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751376#M662175</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;I can incorporate that into Marcus' answer - or edit it in that way.&lt;/P&gt;&lt;P&gt;That looks even better.&lt;/P&gt;&lt;P&gt;I cannot be sure, but I would guess that with your variation, the variables don't exist at all anymore and thus do not take any space whereas with my method, the variables still exist, albeit with no value assigned.&lt;/P&gt;&lt;P&gt;Can anybody confirm whether this is right?&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DataNibbler&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Feb 2015 14:02:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751376#M662175</guid>
      <dc:creator>datanibbler</dc:creator>
      <dc:date>2015-02-05T14:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: Cleanup in script - set variables to NULL</title>
      <link>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751377#M662176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have this exact same question, DataNibbler.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any answer to this one yet?&amp;nbsp; If not, I'll re-post as a separate topic to the community.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm looking towards performance: how does SET = ; compare to LET = NULL(): in terms of performance?&amp;nbsp; Or is it so negligible that it is &lt;SPAN style="font-size: 13.3333330154419px;"&gt;insignificant?&lt;/SPAN&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Mar 2015 21:42:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751377#M662176</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-16T21:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: Cleanup in script - set variables to NULL</title>
      <link>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751378#M662177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From a performance point of view there will be none big difference between set v =; or let v = null(); I think the engine will be able to execute thousands from such statements within a second .... maybe by one a few more ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 06:03:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751378#M662177</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2015-03-17T06:03:07Z</dc:date>
    </item>
    <item>
      <title>Re: Cleanup in script - set variables to NULL</title>
      <link>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751379#M662178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the answer, Marcus.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the end, I'm opting to use SET v = ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 1. It empties the variable so the value isn't stored (which is the point)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 2. It retains the variable for the next run so it doesn't have to be created again&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Neither of these are likely to be noticeable as variable allocation/deallocation is not system-intensive.&amp;nbsp; It's more about best practices and deciding the best way to build something for future re-use.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a side note, if I had a large, generic clean-up script that resets many (1000's) of the same variables across multiple scripts, I might opt for LET v = NULL(); instead.&amp;nbsp; This is so the SET statements don't create needless variables that linger in applications where they are not used.&amp;nbsp; But this is not a best-practice, either.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 15:01:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cleanup-in-script-set-variables-to-NULL/m-p/751379#M662178</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-17T15:01:53Z</dc:date>
    </item>
  </channel>
</rss>

