13 Replies Latest reply: Apr 8, 2014 9:43 AM by Nicola Sardone RSS

    Forcing selection in listbox according to item selection in other listbox with macro

    Louwrie Terblanche





      I would really appreciate some help with something im stuck with for a while now.


      I came across this thread that has exactly what I want and implemented the macro into my model.

      http://community.qlik.com/message/43182#43182  this is where you force a selection in a listbox.

      I have two listboxes with codes in that are the same but form two different tables in my model. When you do a selection on one or more items in the one listbox it will cause the items with the same value in the other listbox to be selected. 

      I have put in a messagebox in the macro to see if it picks up the selected value and it does – but for some reason it does not select the items in the other listbox.

      Macro that I activate with a button as in sample app in link above

      SUB GetSelectedValues


           SET fx = ActiveDocument.Fields("Code")              

           SET fy = ActiveDocument.Fields("TransCodeKey")

           SET fyV = fy.GetNoValues 


           FOR i = 0 TO fxV.Count -1                


                 fyV(i).Text = fxV(i).Text


                 fyV(i).IsNumeric = False


           fy.SelectValues fyV


      END SUB


      It works 100% in demo app but am I missing perhaps a setting somewhere in qlikview ? Can it be settings ? the 2 tables of mine are excatly the same - so it cant be that the values are not equal.



      Thank you