Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

jduenyas
Contributor III

Select in ListBox via VB Code

Hi all

can a selection of 2 or more items in a listbox be done via code in VB?

ActiveDocument.Fields("SalesRep").Select "ABC" works fine but how can I select more than just one, say "ABC" and "BCD" and "CDE"

Thanks

Josh

1 Solution

Accepted Solutions

Select in ListBox via VB Code

Hi,

   

sub Select_Value
rem ** cancel selection of first selected value **
set f = ActiveDocument.Fields("SalesRep")
set fv = f.GetSelectedValues
fv.RemoveAt 0
f.SelectValues fv

rem ** select two non-consecutive field values in field **
set f = ActiveDocument.Fields("SalesRep")
set fv = f.GetNoValues 'empty array
fv.Add
fv.Add
fv(0).Text = "ABC"
fv(0).IsNumeric = false
fv(1).Text = "BCD"
fv(1).IsNumeric = false
f.SelectValues fv

end sub

Regards,

Kaushik Solanki    

2 Replies

Select in ListBox via VB Code

Hi,

   

sub Select_Value
rem ** cancel selection of first selected value **
set f = ActiveDocument.Fields("SalesRep")
set fv = f.GetSelectedValues
fv.RemoveAt 0
f.SelectValues fv

rem ** select two non-consecutive field values in field **
set f = ActiveDocument.Fields("SalesRep")
set fv = f.GetNoValues 'empty array
fv.Add
fv.Add
fv(0).Text = "ABC"
fv(0).IsNumeric = false
fv(1).Text = "BCD"
fv(1).IsNumeric = false
f.SelectValues fv

end sub

Regards,

Kaushik Solanki    

jduenyas
Contributor III

Select in ListBox via VB Code

Thank you!

Every such little hint helps build up the knowledge.

Much appreciated.

Josh

Community Browser