<?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: Macro script: Count current selected values in field in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Macro-script-Count-current-selected-values-in-field/m-p/917613#M652039</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the condition is true? did you try msgbox to test?&lt;/P&gt;&lt;P&gt;the Syntax Looks good. I made a small example (without condition ) and the field is locked&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 10 Aug 2015 15:15:30 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-08-10T15:15:30Z</dc:date>
    <item>
      <title>Macro script: Count current selected values in field</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-script-Count-current-selected-values-in-field/m-p/917612#M652038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm currently using a macro with an if statement that goes like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; if ActiveDocument.Fields("%VIEW_NAME").GetSelectedValues.count &amp;gt; 0 then &lt;/P&gt;&lt;P&gt;ActiveDocument.Fields("PB_User_Flag").Lock&lt;/P&gt;&lt;P&gt;&amp;nbsp; ActiveDocument.Fields("MASTER_ID").Lock&lt;/P&gt;&lt;P&gt;end if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yet, when the macro is triggered, the above fields are not locking. Any insights??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Aug 2015 15:06:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-script-Count-current-selected-values-in-field/m-p/917612#M652038</guid>
      <dc:creator />
      <dc:date>2015-08-10T15:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Macro script: Count current selected values in field</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-script-Count-current-selected-values-in-field/m-p/917613#M652039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the condition is true? did you try msgbox to test?&lt;/P&gt;&lt;P&gt;the Syntax Looks good. I made a small example (without condition ) and the field is locked&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Aug 2015 15:15:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-script-Count-current-selected-values-in-field/m-p/917613#M652039</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-10T15:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Macro script: Count current selected values in field</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-script-Count-current-selected-values-in-field/m-p/917614#M652040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If i test with a text box in the dashboard GetSelectedCount(%VIEW_NAME), the result is 1. But when I test with a msgbox in the macro script, nothing appears. Not sure what is missing here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Aug 2015 15:28:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-script-Count-current-selected-values-in-field/m-p/917614#M652040</guid>
      <dc:creator />
      <dc:date>2015-08-10T15:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: Macro script: Count current selected values in field</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-script-Count-current-selected-values-in-field/m-p/917615#M652041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try as first Expression in macro&lt;/P&gt;&lt;P&gt;what is the result? if not 1 then check your field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;msgbox ActiveDocument.Fields(("%VIEW_NAME").).GetSelectedValues.count&amp;nbsp; &lt;/P&gt;&lt;P&gt;I tested with same condition and for me it works!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Aug 2015 15:32:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-script-Count-current-selected-values-in-field/m-p/917615#M652041</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-10T15:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: Macro script: Count current selected values in field</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-script-Count-current-selected-values-in-field/m-p/917616#M652042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very strange, the message box comes up as 1, but then nothing locks. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Aug 2015 16:25:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-script-Count-current-selected-values-in-field/m-p/917616#M652042</guid>
      <dc:creator />
      <dc:date>2015-08-10T16:25:09Z</dc:date>
    </item>
    <item>
      <title>Re: Macro script: Count current selected values in field</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-script-Count-current-selected-values-in-field/m-p/917617#M652043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can you lock the fields with button "lock"?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Aug 2015 16:53:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-script-Count-current-selected-values-in-field/m-p/917617#M652043</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-10T16:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: Macro script: Count current selected values in field</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-script-Count-current-selected-values-in-field/m-p/917618#M652044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you need to create at first an object and could then query the count:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dim doc, myField&lt;/P&gt;&lt;P&gt;doc = ActiveDocument&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;set myField&lt;/STRONG&gt; = doc.GetSelectedValues&lt;/P&gt;&lt;P&gt;' msgbox myField.count 'optional for check&lt;/P&gt;&lt;P&gt;if myField.count &amp;gt; 0 then &lt;/P&gt;&lt;P&gt;&amp;nbsp; doc.Fields("PB_User_Flag").Lock&lt;/P&gt;&lt;P&gt;&amp;nbsp; doc.Fields("MASTER_ID").Lock&lt;/P&gt;&lt;P&gt;end if&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, 11 Aug 2015 10:37:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-script-Count-current-selected-values-in-field/m-p/917618#M652044</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2015-08-11T10:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: Macro script: Count current selected values in field</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-script-Count-current-selected-values-in-field/m-p/917619#M652045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, If you set the lock otuside the If(), it works?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Aug 2015 11:34:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-script-Count-current-selected-values-in-field/m-p/917619#M652045</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2015-08-11T11:34:55Z</dc:date>
    </item>
  </channel>
</rss>

