2 Replies Latest reply: Aug 6, 2012 7:28 AM by Martin Mahler RSS

    Conditional trigger Select field

    Martin Mahler

      Hello everyone,


      I have a hard time finding a solution to the following challenge:


      There is a variable called vselection.

      While vselection has the value 1, I want an automatic trigger on Field 1, which selects the same values in Field 2. Something like a synchronisation.

      When the variable is on 0, the synchronisation should be turned off, thus selections in Field 1 don't affect selections in Field 2 anymore.


      Idea 1:


      The code should look something like this:

      Trigger in Field 1

      Select Field


      =if(vselection=1, [Field 2])


      ='=sum({<[Field 2]=[Field 1]>}1)'

      Unfortunality though, QlikView does not support conditional statements in the Field section which means that the above code is not working.


      Idea 2:

      Trigger in Field 1

      Select Field


      [Field 2]


      =if(vselection=1,'=sum({<[Field 2]=[Field 1]>}1)')

      This works fine while vselection has the value 1. Once it's 0 though, the trigger clears Field 2 which is not desirable. I want to keep the selections in Field 2.


      Your help is appreciated



        • Re: Conditional trigger Select field
          Michael Solomovich



          I didn't try this but hope it works:
          Action is selection in flield.
          Field is Field2.
          Search string is:      =if(vSelection=1, <value of Field1>, <value of Field2>).

          If it doesn't work, the oly alternative is to use macro, I think.



            • Re: Conditional trigger Select field
              Martin Mahler

              Thank you for your reply, Michael.


              I actually tried this aswell but I didn't manage to work it out. The problem was how to syntax that the trigger should select the already selected Values in Field 2.



              Luckily, I found a working solution using alternate states:


              Copy selection in <Standart> state to an alternate state, if vselection=1 is selected.

              Make all necessary selection with "Select Field" Trigger.

              If vselection=1, copy back alternate state 1 to <Standart>.