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

How to script if-else condition in dynamic update action

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/ScriptControlStatement...

I also found another Syntax here IF & Else condition :

Simple if function:

if(condition , then , else)

Thank you in advance.

Tuan