Skip to main content
Announcements
See why Qlik was named a Leader in the 2024 Gartner® Magic Quadrant™ for Data Integration Tools for the ninth year in a row: Get the report
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikviewwizard
Master II
Master II

switch control statement

Hi All,

I am not clear about switch control statement.

Please give an example to Switch.

Thanks in advance.

2 Replies
Ralf-Narfeldt
Employee
Employee

This is from the QlikView help.

If I evaluates to 1, the first load statement is executed, if I evaluates to 2 the second load statement is executed and in any other case the third load statement is executed.

Examples:

switch I

case 1

load '$(I): CASE 1' as case autogenerate 1;

case 2

load '$(I): CASE 2' as case autogenerate 1;

default

load '$(I): DEFAULT' as case autogenerate 1;

end switch

Anonymous
Not applicable

Hi,

Switch control statement(conditional statement) used to control logical flow of script execution. Executes one of many choices,based on the value of an expression. If no match is found for the value, the DEFAULT statements are executed.

SWITCH I

CASE 1

[Executed when ‘I’ is 1]

CASE 2

[Executed when ‘I’ is 2]

CASE 3

[Executed when ‘I’ is 3]

DEFAULT

[Executed when ‘I’ is not 1 or 2 or 3]

END SWITCH

Examples:

switch I

case 1

load '$(I): CASE 1' as case autogenerate 1;

case 2

load '$(I): CASE 2' as case autogenerate 1;

default

load '$(I): DEFAULT' as case autogenerate 1;

end switch

Regards

Neetha