<?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 select next value in Listbox in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221446#M74256</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rakesh,&lt;/P&gt;&lt;P&gt;This is exactly what I was looking for, many thanks!&lt;/P&gt;&lt;P&gt;Just to make sure I understand what this code does: it loops through the listbox until it finds the currently selected value, when it does it sets the "IamDone" flag so that during the next iteration of the loop it exits and selects the next value.&lt;/P&gt;&lt;P&gt;Changing &lt;B&gt;&lt;I&gt;for i=0 to val.Count-1&lt;/I&gt;&lt;/B&gt; to &lt;B&gt;&lt;I&gt;for i=val.Count-1 to 0 step -1&lt;/I&gt;&lt;/B&gt; makes the code select the previous value.&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 SelectNext&lt;BR /&gt; set mySelections = ActiveDocument.fields("Id").GetSelectedValues(1)&lt;BR /&gt; ActiveDocument.Fields("Id").Clear&lt;BR /&gt; if mySelections.Count = 0 then&lt;BR /&gt; set val=ActiveDocument.Fields("Id").GetPossibleValues(1)&lt;BR /&gt; ValueToSelect = val.Item(0).Text&lt;BR /&gt; else&lt;BR /&gt; set val=ActiveDocument.Fields("Id").GetPossibleValues&lt;BR /&gt; IamDone = " "&lt;BR /&gt; for i=0 to val.Count-1&lt;BR /&gt; ValueToSelect = val.Item(i).Text&lt;BR /&gt; if IamDone = "X" then&lt;BR /&gt; exit for&lt;BR /&gt; end if&lt;BR /&gt;&lt;BR /&gt; if val.Item(i).Text = mySelections.Item(0).text then&lt;BR /&gt; IamDone = "X"&lt;BR /&gt; end if&lt;BR /&gt; next&lt;BR /&gt; end if&lt;BR /&gt; ActiveDocument.Fields("Id").Select ValueToSelect&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>Tue, 13 Jul 2010 16:45:12 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-07-13T16:45:12Z</dc:date>
    <item>
      <title>Macro to select next value in Listbox</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221444#M74254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a listbox that can only have 1 selected value and want to create buttons that select the next (or previous) value in the listbox. In pseudo code, it should do the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;Sub SelectNext&lt;BR /&gt; get [index of currently selected value]&lt;BR /&gt; if index &amp;lt; [number of rows in listbox] then&lt;BR /&gt; listbox.select [index + 1]&lt;BR /&gt; end if&lt;BR /&gt;End Sub&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone share a macro that would accomplish this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jul 2010 07:06:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221444#M74254</guid>
      <dc:creator />
      <dc:date>2010-07-13T07:06:37Z</dc:date>
    </item>
    <item>
      <title>Macro to select next value in Listbox</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221445#M74255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See enclosed. Hope this helps you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jul 2010 16:07:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221445#M74255</guid>
      <dc:creator>disqr_rm</dc:creator>
      <dc:date>2010-07-13T16:07:04Z</dc:date>
    </item>
    <item>
      <title>Macro to select next value in Listbox</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221446#M74256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rakesh,&lt;/P&gt;&lt;P&gt;This is exactly what I was looking for, many thanks!&lt;/P&gt;&lt;P&gt;Just to make sure I understand what this code does: it loops through the listbox until it finds the currently selected value, when it does it sets the "IamDone" flag so that during the next iteration of the loop it exits and selects the next value.&lt;/P&gt;&lt;P&gt;Changing &lt;B&gt;&lt;I&gt;for i=0 to val.Count-1&lt;/I&gt;&lt;/B&gt; to &lt;B&gt;&lt;I&gt;for i=val.Count-1 to 0 step -1&lt;/I&gt;&lt;/B&gt; makes the code select the previous value.&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 SelectNext&lt;BR /&gt; set mySelections = ActiveDocument.fields("Id").GetSelectedValues(1)&lt;BR /&gt; ActiveDocument.Fields("Id").Clear&lt;BR /&gt; if mySelections.Count = 0 then&lt;BR /&gt; set val=ActiveDocument.Fields("Id").GetPossibleValues(1)&lt;BR /&gt; ValueToSelect = val.Item(0).Text&lt;BR /&gt; else&lt;BR /&gt; set val=ActiveDocument.Fields("Id").GetPossibleValues&lt;BR /&gt; IamDone = " "&lt;BR /&gt; for i=0 to val.Count-1&lt;BR /&gt; ValueToSelect = val.Item(i).Text&lt;BR /&gt; if IamDone = "X" then&lt;BR /&gt; exit for&lt;BR /&gt; end if&lt;BR /&gt;&lt;BR /&gt; if val.Item(i).Text = mySelections.Item(0).text then&lt;BR /&gt; IamDone = "X"&lt;BR /&gt; end if&lt;BR /&gt; next&lt;BR /&gt; end if&lt;BR /&gt; ActiveDocument.Fields("Id").Select ValueToSelect&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>Tue, 13 Jul 2010 16:45:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221446#M74256</guid>
      <dc:creator />
      <dc:date>2010-07-13T16:45:12Z</dc:date>
    </item>
    <item>
      <title>Macro to select next value in Listbox</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221447#M74257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, you got the logic correct. That's exactely what it does.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jul 2010 18:28:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221447#M74257</guid>
      <dc:creator>disqr_rm</dc:creator>
      <dc:date>2010-07-13T18:28:17Z</dc:date>
    </item>
    <item>
      <title>Macro to select next value in Listbox</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221448#M74258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You already have a button that does that. Click on the listbox title to activate it and then click the down arrow on your keyboard. The selection will move to the next value.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jul 2010 19:10:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221448#M74258</guid>
      <dc:creator />
      <dc:date>2010-07-13T19:10:04Z</dc:date>
    </item>
    <item>
      <title>Macro to select next value in Listbox</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221449#M74259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Much simpler macro to do the same thing:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;sub selectNext&lt;BR /&gt; ActiveDocument.getField("LIB_CENTRE").select ActiveDocument.Evaluate("minstring({1}if(LIB_CENTRE&amp;gt;'$(=LIB_CENTRE)',LIB_CENTRE))")&lt;BR /&gt;end sub&lt;/P&gt;&lt;P&gt;Another couple approaches are to hide a slider bar behind the list box with only the arrow icons showing, or to use a semantic load and select previous/next that way. I can post examples of all three if desired. But I think just using the keyboard is the best approach.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jul 2010 19:58:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221449#M74259</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-07-13T19:58:48Z</dc:date>
    </item>
    <item>
      <title>Macro to select next value in Listbox</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221450#M74260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rakesh&lt;/P&gt;&lt;P&gt;The macro works perfectly; thank you very much for posting it!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What changes are required to make it into a 'Select Previous' instead of a 'Select Next' macro?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your help is much appreciated.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Patrik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 13 Nov 2010 00:29:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221450#M74260</guid>
      <dc:creator />
      <dc:date>2010-11-13T00:29:31Z</dc:date>
    </item>
    <item>
      <title>Macro to select next value in Listbox</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221451#M74261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Patrik&lt;/P&gt;&lt;P&gt;According to ph1979&lt;/P&gt;&lt;P&gt;"Changing &lt;B&gt;&lt;I&gt;for i=0 to val.Count-1&lt;/I&gt;&lt;/B&gt; to &lt;B&gt;&lt;I&gt;for i=val.Count-1 to 0 step -1&lt;/I&gt;&lt;/B&gt; makes the code select the previous value."&lt;/P&gt;&lt;P&gt;Did you try that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 13 Nov 2010 02:19:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221451#M74261</guid>
      <dc:creator>disqr_rm</dc:creator>
      <dc:date>2010-11-13T02:19:58Z</dc:date>
    </item>
    <item>
      <title>Macro to select next value in Listbox</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221452#M74262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That works perfect as well, but when I use that macro the 'Next' macro does not work anymore. It seems like I am only able to have one (1) macro per sheet even if the name of the second one a different name??&lt;/P&gt;&lt;P&gt;To be able to have one 'next' and one 'previous' button on the same sheet it seems like I need to use one (1) macro for both. I guess this can be done by writing the macro twice user separate IF statements using &lt;B&gt;&lt;I&gt;or i=0 to val.Count-1&lt;/I&gt;&lt;/B&gt; and &lt;B&gt;&lt;I&gt;for i=val.Count-1 to 0 step -1.&lt;/I&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;How would I write the IF statement though:)?&lt;/P&gt;&lt;P style="font-style: italic; font-weight: bold"&gt;Thank you very much!!&lt;/P&gt;&lt;P style="font-style: italic; font-weight: bold"&gt;-P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 13 Nov 2010 09:30:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221452#M74262</guid>
      <dc:creator />
      <dc:date>2010-11-13T09:30:35Z</dc:date>
    </item>
    <item>
      <title>Macro to select next value in Listbox</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221453#M74263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have used the macro Rakesh supplied, which seems to traverse the list of values for my list box pretty well, but it does not traverse them in order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is also true when attempting to use a slider. I have values for an "Item Number" loaded in alphanumeric order, but when I attempt to use this macro or a slider, few items will be in order, but it mostly jumps around the list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there anything I should be checking for?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An acceptable substitution for this solution would be a static (selected value doesn't jump to top) list box that removes excluded values while leaving a &lt;EM&gt;contiuous&lt;/EM&gt; list of the possible field values which are based on other selections, which I have not been able to accomplish. Selecting this box and hitting arrow up/down would be acceptable, but it needs to show the entire list of possible items. I can arrow up/down now, which traverses the list in order, but does not display the full available list or items.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Nov 2011 17:40:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221453#M74263</guid>
      <dc:creator>richardpayne</dc:creator>
      <dc:date>2011-11-02T17:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to select next value in Listbox</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221454#M74264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you soo much!!!&lt;/P&gt;&lt;P&gt;Both of answers worked to me, but yours keep the right order of my clients field.&amp;nbsp;&amp;nbsp; &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/grin.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Aug 2017 18:03:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-select-next-value-in-Listbox/m-p/221454#M74264</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-08-02T18:03:46Z</dc:date>
    </item>
  </channel>
</rss>

