<?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 Macro to clear variables in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Macro-to-clear-variables/m-p/222654#M503243</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;H3&gt;I have a QVW like a financial statement and i have added a formula which links to a variable where i enter for example 25.00 and the financial statement will automatically adjust one line item according to the 25.00 i entered in a varaible. The 25.00 is linked to the Rate. The current rate is 20 but i have added a formula where if i change the varaible to 25.00 then the revenue will change accordingly.&lt;/H3&gt;&lt;P&gt;What i need to be able to do is run a macro which will clear the variable from 25.00 to 0.00 when needed. I have multiple rates for various line items so i need to be able to clear them rather than having to go back and enter 0.00 in each variable.&lt;/P&gt;&lt;P&gt;Revenue = 100&lt;/P&gt;&lt;P&gt;Membership = 5&lt;/P&gt;&lt;P&gt;Rate = 20.00&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;New After 25.00&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Revenue = 125&lt;/P&gt;&lt;P&gt;Membership = 5&lt;/P&gt;&lt;P&gt;Rate = 25.00&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Krishan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Apr 2010 17:22:38 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-04-22T17:22:38Z</dc:date>
    <item>
      <title>Macro to clear variables</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-clear-variables/m-p/222654#M503243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;H3&gt;I have a QVW like a financial statement and i have added a formula which links to a variable where i enter for example 25.00 and the financial statement will automatically adjust one line item according to the 25.00 i entered in a varaible. The 25.00 is linked to the Rate. The current rate is 20 but i have added a formula where if i change the varaible to 25.00 then the revenue will change accordingly.&lt;/H3&gt;&lt;P&gt;What i need to be able to do is run a macro which will clear the variable from 25.00 to 0.00 when needed. I have multiple rates for various line items so i need to be able to clear them rather than having to go back and enter 0.00 in each variable.&lt;/P&gt;&lt;P&gt;Revenue = 100&lt;/P&gt;&lt;P&gt;Membership = 5&lt;/P&gt;&lt;P&gt;Rate = 20.00&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;New After 25.00&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Revenue = 125&lt;/P&gt;&lt;P&gt;Membership = 5&lt;/P&gt;&lt;P&gt;Rate = 25.00&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Krishan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Apr 2010 17:22:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-clear-variables/m-p/222654#M503243</guid>
      <dc:creator />
      <dc:date>2010-04-22T17:22:38Z</dc:date>
    </item>
    <item>
      <title>Macro to clear variables</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-clear-variables/m-p/222655#M503245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Krishan,&lt;/P&gt;&lt;P&gt;This macro will reset all variables to 0.0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;s&lt;B&gt;ub&lt;/B&gt; reset_vars&lt;B&gt;&lt;/B&gt;&lt;/P&gt;&lt;P style="font-weight: bold"&gt;set&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;doc=ActiveDocument&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;set&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;for&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;set&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;v = vars.Item(i) "0.0" , &lt;B&gt;true&lt;/B&gt;&lt;P style="font-weight: bold"&gt;next&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;set&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;v = &lt;B&gt;nothing&lt;/B&gt;&lt;P&gt;set&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;vars = &lt;B&gt;nothing&lt;/B&gt;&lt;P&gt;set&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;doc = &lt;B&gt;nothing&lt;/B&gt;&lt;P&gt;end&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;&lt;B&gt;sub&lt;/B&gt; Kind regards i = 0 to vars.Count - 1 vars = doc.GetVariableDescriptions&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;STRONG&gt;Huub&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Apr 2010 18:43:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-clear-variables/m-p/222655#M503245</guid>
      <dc:creator />
      <dc:date>2010-04-22T18:43:18Z</dc:date>
    </item>
    <item>
      <title>Macro to clear variables</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-clear-variables/m-p/222656#M503246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What if i only want to reset selected variables? I have other variables which should not be touched because they feed other formulas.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Apr 2010 18:48:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-clear-variables/m-p/222656#M503246</guid>
      <dc:creator />
      <dc:date>2010-04-22T18:48:21Z</dc:date>
    </item>
    <item>
      <title>Macro to clear variables</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-clear-variables/m-p/222657#M503247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When the variables you want to reset start with the same prefix. like PAR_rate, PAR_index etc.. You can add a selection around the reset-part within the for/next loop.&lt;/P&gt;&lt;P&gt;if mid(v.Name,1,3)= "PAR" then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;doc.Variables(v.Name).SetContent&lt;/P&gt;&lt;P&gt;"0.0", &lt;B&gt;true&lt;/B&gt;&lt;/P&gt;&lt;P style="font-weight: bold"&gt;end if&lt;/P&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;&lt;P style="font-weight: bold"&gt;Huub&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Apr 2010 19:34:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-clear-variables/m-p/222657#M503247</guid>
      <dc:creator />
      <dc:date>2010-04-22T19:34:54Z</dc:date>
    </item>
    <item>
      <title>Macro to clear variables</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-clear-variables/m-p/222658#M503248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok this might work because the variables which i would like to change to 0.00 all begin with v_NEW. I am not familiar with Macros and how to set them up or where to paste this formula you have created?&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;Really appreciated it!!!!&lt;/P&gt;&lt;P&gt;Krishan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Apr 2010 21:09:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-clear-variables/m-p/222658#M503248</guid>
      <dc:creator />
      <dc:date>2010-04-22T21:09:44Z</dc:date>
    </item>
    <item>
      <title>Macro to clear variables</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-clear-variables/m-p/222659#M503249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was able to use this formula:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;&lt;P style="font-weight: bold"&gt;SUB&lt;/P&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"v_NewCommRate"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;).SetContent "0.00", &lt;B&gt;true&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;&lt;/B&gt;"v_NewPRate").SetContent "0.00", &lt;B&gt;true&lt;/B&gt;&lt;/P&gt;&lt;P style="font-weight: bold"&gt;"v_NewHRate"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;).SetContent "0.00", &lt;B&gt;true&lt;/B&gt;&lt;/P&gt;&lt;P style="font-weight: bold"&gt;"v_NewMRate"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;).SetContent "0.00", &lt;B&gt;true&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;END&lt;/B&gt; &lt;B&gt;SUB&lt;/B&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; Macro1&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Apr 2010 22:03:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-clear-variables/m-p/222659#M503249</guid>
      <dc:creator />
      <dc:date>2010-04-22T22:03:41Z</dc:date>
    </item>
    <item>
      <title>Macro to clear variables</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-clear-variables/m-p/222660#M503251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Ok,&lt;BR /&gt;Open your document.&lt;BR /&gt;open macro-editor (Menu Tools, edit Module).&lt;BR /&gt;Copy/past the code below.&lt;BR /&gt;Press Ok.&lt;BR /&gt;In your document insert a button. (New sheet-object, button).&lt;BR /&gt;Give it a text and ten press tab actions.&lt;BR /&gt;press add, action type = external, click run-macro , press Ok and fill in the macro-name: reset_vars&lt;BR /&gt;Now you have a button, that will run the macro&lt;BR /&gt;Huub&lt;BR /&gt;&lt;BR /&gt;sub reset_vars&lt;BR /&gt; set doc=ActiveDocument&lt;BR /&gt; set vars = doc.GetVariableDescriptions&lt;BR /&gt; for i = 0 to vars.Count - 1&lt;BR /&gt; set v = vars.Item(i)&lt;BR /&gt; if mid(v.Name,1,5) = "v_NEW" then&lt;BR /&gt; doc.Variables(v.Name).SetContent "0.0", true&lt;BR /&gt; end if&lt;BR /&gt; next&lt;BR /&gt; set v = nothing&lt;BR /&gt; set vars = nothing&lt;BR /&gt; set doc = nothing&lt;BR /&gt;end sub&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Apr 2010 22:11:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-clear-variables/m-p/222660#M503251</guid>
      <dc:creator />
      <dc:date>2010-04-22T22:11:17Z</dc:date>
    </item>
  </channel>
</rss>

