<?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 Deselect value from list box using macro in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Deselect-value-from-list-box-using-macro/m-p/181285#M47372</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for bringing up about infinit loop. Haven't given a thought about it yet. But, in my actual document that I am working with , the list box that contains 20 different values. If the sum is &amp;gt;300, i need to deselect only values "Part1, Part2 and Part3" if they are selected else leave the rest of the selection as is.&lt;/P&gt;&lt;P&gt;Can you suggest on how to approach this?&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Jun 2010 17:12:41 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-06-08T17:12:41Z</dc:date>
    <item>
      <title>Deselect value from list box using macro</title>
      <link>https://community.qlik.com/t5/QlikView/Deselect-value-from-list-box-using-macro/m-p/181283#M47370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to deselect a value from the list box if the sum of total parts in this example is greater than the threshold in this case 300.&lt;/P&gt;&lt;P&gt;Can someone please help me with the macro to do this.&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;P&gt;Chaya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jun 2010 16:42:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Deselect-value-from-list-box-using-macro/m-p/181283#M47370</guid>
      <dc:creator />
      <dc:date>2010-06-08T16:42:59Z</dc:date>
    </item>
    <item>
      <title>Deselect value from list box using macro</title>
      <link>https://community.qlik.com/t5/QlikView/Deselect-value-from-list-box-using-macro/m-p/181284#M47371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First, I created a variable called vSumParts with a value of:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;=Sum(Parts)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Then I used the following macro, which will deselect the first selected value when the Sum of Parts is greater than 300.&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Sub DeselectPart&lt;BR /&gt; val = ActiveDocument.Variables("vSumParts").GetContent.String&lt;BR /&gt; set fld = ActiveDocument.Fields("Description")&lt;BR /&gt;&lt;BR /&gt; if val &amp;gt; 300 then&lt;BR /&gt; set mySelections = fld.GetSelectedValues&lt;BR /&gt;&lt;BR /&gt; fld.ToggleSelect mySelections.Item(0).text&lt;BR /&gt; end if&lt;BR /&gt;End Sub&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;You would put this in the OnSelect of the field. The problem is, if only one value is selected and you deselect it, the Sum of Parts will be more than what it was and you'd end up with some sort of infinite loop. How do you intend to handle that situation? You probably want some logic in there to make sure there are selected values in the field.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jun 2010 16:56:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Deselect-value-from-list-box-using-macro/m-p/181284#M47371</guid>
      <dc:creator />
      <dc:date>2010-06-08T16:56:05Z</dc:date>
    </item>
    <item>
      <title>Deselect value from list box using macro</title>
      <link>https://community.qlik.com/t5/QlikView/Deselect-value-from-list-box-using-macro/m-p/181285#M47372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for bringing up about infinit loop. Haven't given a thought about it yet. But, in my actual document that I am working with , the list box that contains 20 different values. If the sum is &amp;gt;300, i need to deselect only values "Part1, Part2 and Part3" if they are selected else leave the rest of the selection as is.&lt;/P&gt;&lt;P&gt;Can you suggest on how to approach this?&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jun 2010 17:12:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Deselect-value-from-list-box-using-macro/m-p/181285#M47372</guid>
      <dc:creator />
      <dc:date>2010-06-08T17:12:41Z</dc:date>
    </item>
    <item>
      <title>Deselect value from list box using macro</title>
      <link>https://community.qlik.com/t5/QlikView/Deselect-value-from-list-box-using-macro/m-p/181286#M47373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is my approach to this. Its working on what I need to do.&lt;/P&gt;&lt;P&gt;sub ClearSelection&lt;BR /&gt; val =ActiveDocument.Variables("vRowCount").GetContent.String&lt;BR /&gt; Set SelectedField=ActiveDocument.Fields("DESCRIPTION")&lt;BR /&gt; if val &amp;gt; 400 then&lt;BR /&gt; Set MySelections = SelectedField.GetSelectedValues&lt;BR /&gt; SelectedField.ToggleSelect "Claim Number"&lt;BR /&gt; end if&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;Thank you getting me started.&lt;/P&gt;&lt;P&gt;Chaya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jun 2010 18:18:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Deselect-value-from-list-box-using-macro/m-p/181286#M47373</guid>
      <dc:creator />
      <dc:date>2010-06-08T18:18:14Z</dc:date>
    </item>
    <item>
      <title>Deselect value from list box using macro</title>
      <link>https://community.qlik.com/t5/QlikView/Deselect-value-from-list-box-using-macro/m-p/181287#M47374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;GetSelectedValues creates an array of selected values. Then use fld.ToggleSelect mySelections.Item(0).text to determine the actual selected value. If one of the values is already selected, ToggleSelect will unselect it. If one of the values is not selected, it will not come up in this array. Basically, if&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;...&lt;BR /&gt;mySelections.Item(0).text = 'Part1' or mySelections.Item(0).text = 'Part2' then&lt;BR /&gt; fld.ToggleSelect mySelections.Item(0).text&lt;BR /&gt;end if&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Or something like that...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jun 2010 19:01:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Deselect-value-from-list-box-using-macro/m-p/181287#M47374</guid>
      <dc:creator />
      <dc:date>2010-06-08T19:01:21Z</dc:date>
    </item>
  </channel>
</rss>

