If..then..elseif..else..end if

The if..then control statement is a script selection construct forcing the script execution to follow different paths depending on one or several logical conditions.

if - script and chart function (script and chart function)


If  condition then

  [ statements ]

{ elseif condition then

  [ statements ] }

[ else

  [ statements ] ]

end if


Since the if..then statement is a control statement and as such is ended with either a semicolon or end-of-line, each of its four possible clauses (if..then, elseif..then, else and end if) must not cross a line boundary.


Argument Description
condition A logical expression which can be evaluated as True or False.
statements Any group of one or more QlikView script statements.

Example 1:  

if a=1 then

LOAD * from abc.csv;

SQL SELECT e, f, g from tab1;

end if

Example 2:  

if a=1 then; drop table xyz; end if;

Example 3:  

if x>0 then

LOAD * from pos.csv;

elseif x<0 then

LOAD * from neg.csv;


LOAD * from zero.txt;

end if

See also:


Did this information help you?

Thanks for letting us know. Is there anything you'd like to tell us about this topic?

Can you tell us why it did not help you and how we can improve it?