0 Replies Latest reply: Aug 23, 2012 9:52 PM by Niels van Diermen RSS

    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.

       

      [code]

      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

      [/code]