Skip to main content Skip to complementary content

Unless

The unless prefix and suffix is used for creating a conditional clause which determines whether a statement or exit clause should be evaluated or not. It may be seen as a compact alternative to the full if..end if statement.

Syntax:  

(Unless condition statement | exitstatement Unless condition )

The statement or the exitstatement will only be executed if condition is evaluated to False.

The unless prefix may be used on statements which already have one or several other statements, including additional when or unless prefixes.

Arguments
Argument Description
condition A logical expression evaluating to True or False.
statement Any Qlik Sense script statement except control statements.
exitstatement An exit for, exit do or exit sub clause or an exit script statement.

When to use it

The Unless statement returns a Boolean result. Typically, this type of function will be used as a condition when the user would like to conditionally load or exclude parts of the script.

The following lines show three examples of how the Unless function may be used:

exit script unless A=1;

unless A=1 LOAD * from myfile.csv;

unless A=1 when B=2 drop table Tab1;

Regional settings

Unless otherwise specified, the examples in this topic use the following date format: MM/DD/YYYY. The date format is specified in the SET DateFormat statement in your data load script. The default date formatting may be different in your system, due to your regional settings and other factors. You can change the formats in the examples below to suit your requirements. Or you can change the formats in your load script to match these examples. For more information, see Modifying regional settings for apps and scripts.

Default regional settings in apps are based on the user profile. These regional format settings are not related to the language displayed in the Qlik Cloud user interface. Qlik Cloud will be displayed in the same language as the browser you are using.

If you are an app creator, you can set the default region for apps you create. For more information, see Setting your preferred regional settings for creating apps and scripts in Qlik Cloud Analytics.

Example 1 – Unless prefix

Example 2 – Unless suffix

Example 3 – Multiple Unless prefixes

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!