<?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 Cleanup macro for variables in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Cleanup-macro-for-variables/m-p/228875#M504248</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;ActiveDocument.RemoveVariable "nameOfVariable"&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 02 Feb 2010 15:58:18 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-02-02T15:58:18Z</dc:date>
    <item>
      <title>Cleanup macro for variables</title>
      <link>https://community.qlik.com/t5/QlikView/Cleanup-macro-for-variables/m-p/228874#M504247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;I've browsing to find a solution to the following problem, but I could not fnid anything that suits the needs. Can anybody help me?&lt;/P&gt;&lt;P&gt;Problem:&lt;/P&gt;&lt;P&gt;QlikView file is reading an Excel- file, containing calculation formulas and putting them into variables (at the time 64 formulas and might grow or shrink). Due to possible changes in the formulas, some variables might be unnecessary during a reload.&lt;/P&gt;&lt;P&gt;I was trying to find a macro or something that showed me what the possible function calls for the variable collection are. Since ActiveDocument.Variables("varName").Delete does not work (i.e. there is no such sub function!) I cannot reset nor delete the variables.&lt;/P&gt;&lt;P&gt;I got so far that I had the variable name in a VBScript variable and could get a msgbox to react to the content, but what then?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;sub cleanVariables&lt;BR /&gt;Set VariableCollection = ActiveDocument.GetVariableDescriptions&lt;BR /&gt;for i = 0 to VariableCollection.Count - 1&lt;BR /&gt; set tempVarName = VariableCollection.Item(i).Name&lt;BR /&gt; if left(tempVarName,3) = "tot" then&lt;BR /&gt; '' Here I should put some code to&lt;BR /&gt; '' delete the variable, but WHAT??&lt;BR /&gt; end if&lt;BR /&gt;next&lt;BR /&gt;end sub&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;Or is there a workaround for this?&lt;/P&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;Sören&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Feb 2010 14:13:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cleanup-macro-for-variables/m-p/228874#M504247</guid>
      <dc:creator />
      <dc:date>2010-02-02T14:13:03Z</dc:date>
    </item>
    <item>
      <title>Cleanup macro for variables</title>
      <link>https://community.qlik.com/t5/QlikView/Cleanup-macro-for-variables/m-p/228875#M504248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;ActiveDocument.RemoveVariable "nameOfVariable"&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Feb 2010 15:58:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cleanup-macro-for-variables/m-p/228875#M504248</guid>
      <dc:creator />
      <dc:date>2010-02-02T15:58:18Z</dc:date>
    </item>
    <item>
      <title>Cleanup macro for variables</title>
      <link>https://community.qlik.com/t5/QlikView/Cleanup-macro-for-variables/m-p/228876#M504249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Steve,&lt;/P&gt;&lt;P&gt;This was just what I was looking for. Thank you!&lt;/P&gt;&lt;P&gt;And for those interested, here's the working code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;sub cleanVariables&lt;BR /&gt; Set VariableCollection = ActiveDocument.GetVariableDescriptions&lt;BR /&gt; for i = 0 to VariableCollection.Count - 1&lt;BR /&gt; set tempVar = VariableCollection.Item(i)&lt;BR /&gt; tempVarName = tempVar.Name&lt;BR /&gt; if left(tempVarName,3) = "tot" then&lt;BR /&gt; 'msgbox "Deleting " &amp;amp; tempVarName&lt;BR /&gt; ActiveDocument.RemoveVariable tempVarName&lt;BR /&gt; end if&lt;BR /&gt; next&lt;BR /&gt;end sub&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Greeting,&lt;/P&gt;&lt;P&gt;Sören&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Feb 2010 07:11:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cleanup-macro-for-variables/m-p/228876#M504249</guid>
      <dc:creator />
      <dc:date>2010-02-03T07:11:41Z</dc:date>
    </item>
  </channel>
</rss>

