Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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.

Not applicable

SelectValues on top of other SelectValues

Hi There,

I'm trying to do the following by programatically selecting values in fields. (long story as to why)...

I've created a simple example below to illustrate the point.

I basically want to select values in 1 field e.g. the PhoneNbr and then also select values in another field e.g. Account_Nbr.

n.b. I can't use the load script, bookmarks, triggers or any internal qlikview functions though as I strictly want to use the api.

What happens is I can only select from one field at a time. The field objects SelectValues call seems to blow away the previous selections.

Is there another method I can try?

Thanks.

Sub SetSelections

          ActiveDocument.Fields("PhoneNbr").Clear

          ActiveDocument.Fields("Account_Nbr").Clear

          set PhoneNbrValues = ActiveDocument.Fields("PhoneNbr").GetNoValues

          PhoneNbrValues.Add()

          PhoneNbrValues.Item(0).text = "0882686988"

          PhoneNbrValues(0).IsNumeric = false

          set Account_NbrValues = ActiveDocument.Fields("Account_Nbr").GetNoValues

          Account_NbrValues.Add()

          Account_NbrValues.Item(0).text = "ABC01"

          Account_NbrValues(0).IsNumeric = false

  Account_NbrValues.Add()

  Account_NbrValues.Item(1).text = "ABC02"

  Account_NbrValues(1).IsNumeric = false

          ActiveDocument.Fields("PhoneNbr").SelectValues PhoneNbrValues ' This filter is lost once the next one is applied.

          ActiveDocument.Fields("Account_Nbr").SelectValues Account_NbrValues 'This is the filter that is applied

END SUB