0 Replies Latest reply: Nov 3, 2016 5:23 AM by Tuan Le RSS

    How to script if-else condition in dynamic update action

    Tuan Le

      Hello QlikView community,

       

      I'm facing the problem to script a (simple) if-else condition in Qlikview.

      I want to pull a trigger when changing the value of a variable (variable event trigger , to be specific the "OnInput" option).

      When adding the dynamic update action, I want to change a fieldvalue with the string I just entered into the variable.

       

      The code looks like this :

       

      if  '$(vCostCentre)' = '' then
        UPDATE ProfitCenterMap
        SET ProfitCenterMap.CarveOutCategory ='$(vClassification)'
        WHERE LineItem.ProfitCentre = '$(vProfitCentre)' ;
      else   
        UPDATE CostCenterMap
        SET CostCenterMap.CarveOutCategory = '$(vClassification)'
        WHERE LineItem.CostCentre = '$(vCostCentre)' ; 
      end if
      

      ----------

       

      I read the qlikview reference Manual and wrote the script above according to: https://help.qlik.com/de-DE/qlikview/12.0/Subsystems/Client/Content/Scripting/ScriptControlStatements/If.htm

       

      I also found another Syntax here IF & Else condition :

      Simple if function:

      if(condition , then , else)

       

       

      Thank you in advance.

       

      Tuan