el

Selecting next value in listbox using button in Qlikview

Saturday, October 17, 2020

The list box is the most basic sheet object. It contains a list of all possible values of a specific field. Each row in the list box can represent several records in the loaded table, all with identical values. Selecting one value may thus be equivalent to selecting several records in the loaded table.   Here we are automating the selection by each line through the macro in button action. This selects each line from top to bottom.   Macro:   Sub SelectNext set mySelections = ActiveDocument.fields("Id").GetSelectedValues(1) ActiveDocument.Fields("Id").Clear if mySelections.Count = 0 then set val=ActiveDocument.Fields("Id").GetPossibleValues(1) ValueToSelect = val.Item(0).Text else set val=ActiveDocument.Fields("Id").GetPossibleValues IamDone = " " for i=0 to val.Count-1 ValueToSelect = val.Item(i).Text if IamDone = "X" then exit for end if if val.Item(i).Text = mySelections.Item(0).text then IamDone = "X" end if next end if ActiveDocument.Fields("Id").Select ValueToSelect End Sub

No items found.