<?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: Run macro on conditional expression? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Run-macro-on-conditional-expression/m-p/362232#M134640</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Hello,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Use this code,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Button -&amp;gt;action -&amp;gt; External -&amp;gt; Run macro -&amp;gt; in macro name give the below code. "&lt;STRONG&gt;Macro" is the name of the Macro Code&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;=If(Count(DISTINCT date)&amp;lt;10,'Macro')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;My macro code is:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Sub Macro&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.GetSheetObject("LB05").SelectAll&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;End Sub&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Cheers!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Hope it helps you.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Jun 2012 10:34:41 GMT</pubDate>
    <dc:creator>jagannalla</dc:creator>
    <dc:date>2012-06-21T10:34:41Z</dc:date>
    <item>
      <title>Run macro on conditional expression?</title>
      <link>https://community.qlik.com/t5/QlikView/Run-macro-on-conditional-expression/m-p/362230#M134638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want a macro to be run when a certain condition is fulfilled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like: If "Count(DISTINCT Field1)&amp;lt;10" then run the macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there anyway to do this? Can't see how this can be done by using triggers/actions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Br&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2012 10:13:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Run-macro-on-conditional-expression/m-p/362230#M134638</guid>
      <dc:creator />
      <dc:date>2012-06-21T10:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: Run macro on conditional expression?</title>
      <link>https://community.qlik.com/t5/QlikView/Run-macro-on-conditional-expression/m-p/362231#M134639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe set a variable to =Count(DISTINCT Field1)&lt;/P&gt;&lt;P&gt;and then use the Variable Event OnChange action?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2012 10:19:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Run-macro-on-conditional-expression/m-p/362231#M134639</guid>
      <dc:creator>m_woolf</dc:creator>
      <dc:date>2012-06-21T10:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Run macro on conditional expression?</title>
      <link>https://community.qlik.com/t5/QlikView/Run-macro-on-conditional-expression/m-p/362232#M134640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Hello,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Use this code,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Button -&amp;gt;action -&amp;gt; External -&amp;gt; Run macro -&amp;gt; in macro name give the below code. "&lt;STRONG&gt;Macro" is the name of the Macro Code&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;=If(Count(DISTINCT date)&amp;lt;10,'Macro')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;My macro code is:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Sub Macro&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.GetSheetObject("LB05").SelectAll&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;End Sub&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Cheers!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Hope it helps you.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2012 10:34:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Run-macro-on-conditional-expression/m-p/362232#M134640</guid>
      <dc:creator>jagannalla</dc:creator>
      <dc:date>2012-06-21T10:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: Run macro on conditional expression?</title>
      <link>https://community.qlik.com/t5/QlikView/Run-macro-on-conditional-expression/m-p/362233#M134641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The Variable Event OnChange action mean that you have to edit the variable expression to execute the action. It doesn't run due to the change in the calculated result in the variable (Count DISTINCT). So that's not the solution, unless I missunderstood.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2012 13:27:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Run-macro-on-conditional-expression/m-p/362233#M134641</guid>
      <dc:creator />
      <dc:date>2012-06-21T13:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: Run macro on conditional expression?</title>
      <link>https://community.qlik.com/t5/QlikView/Run-macro-on-conditional-expression/m-p/362234#M134642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, but this mean you still have to click the button to execute the macro. What I'm looking for is execute a macro whenever the number of distinct values in a certain field is less than 10, due to some selections made in other fields, without having to click a button.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2012 13:31:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Run-macro-on-conditional-expression/m-p/362234#M134642</guid>
      <dc:creator />
      <dc:date>2012-06-21T13:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: Run macro on conditional expression?</title>
      <link>https://community.qlik.com/t5/QlikView/Run-macro-on-conditional-expression/m-p/362235#M134643</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;Go to&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Document Properties Tab&lt;/STRONG&gt;--&amp;gt; &lt;STRONG&gt;Triggers Tab&lt;/STRONG&gt;--&amp;gt; &lt;STRONG&gt;Document Event Trigger&lt;/STRONG&gt; --&amp;gt; Click &lt;STRONG&gt;On Any&amp;nbsp; Select&lt;/STRONG&gt; --&amp;gt; &lt;STRONG&gt;Add Actions&lt;/STRONG&gt; --&amp;gt; &lt;STRONG&gt;External&lt;/STRONG&gt; --&amp;gt; &lt;STRONG&gt;Run Macro&lt;/STRONG&gt; --&amp;gt; &lt;/P&gt;&lt;P&gt;If(Count(Distinct Field1)&amp;lt;10,'Macro')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May be this might helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Satish.A&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-size: 12px; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-family: calibri, verdana, arial, sans-serif; font-size: 12px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2012 13:55:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Run-macro-on-conditional-expression/m-p/362235#M134643</guid>
      <dc:creator />
      <dc:date>2012-06-21T13:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: Run macro on conditional expression?</title>
      <link>https://community.qlik.com/t5/QlikView/Run-macro-on-conditional-expression/m-p/362236#M134644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Ok take one global variable with name vCount and give expression as =Count(DISTINCT Field1). Now create one empty varible with name vCheck.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;- Document properties -&amp;gt; Triggers Tab -&amp;gt; Document event triggers -&amp;gt; OnAnySelect -&amp;gt;Actions -&amp;gt; Add -&amp;gt; External -&amp;gt; RunMacro -&amp;gt; macro name Assign&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;And paste in edit module below code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Sub Assign&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set vCount=ActiveDocument.Variables("vCount")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set vCheck=ActiveDocument.Variables("vCheck")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; vCheck.SetContent vCount.GetContent.String,true&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If vCheck.GetContent.String &amp;lt; 2 then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call(RunMacroCode)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub RunMacroCode&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG&gt; ' Here give ur code &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Cheers!&lt;/P&gt;&lt;P&gt;Hope it helps you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2012 14:09:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Run-macro-on-conditional-expression/m-p/362236#M134644</guid>
      <dc:creator>jagannalla</dc:creator>
      <dc:date>2012-06-21T14:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: Run macro on conditional expression?</title>
      <link>https://community.qlik.com/t5/QlikView/Run-macro-on-conditional-expression/m-p/362237#M134645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards Peter&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit: Just realised this won't work when you toggle Back and Forward between a selection with less and more than ten values.&lt;/P&gt;&lt;P&gt;However, thanks anyway.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit again: Won't work with bookmarks either.&lt;/P&gt;&lt;P&gt;And worst of all, the macro (SQL connection) won't work at all in AJAX &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2012 14:13:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Run-macro-on-conditional-expression/m-p/362237#M134645</guid>
      <dc:creator />
      <dc:date>2012-06-21T14:13:49Z</dc:date>
    </item>
  </channel>
</rss>

