Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi experts,
How to write IF CONDITION in script level ? with example ?
IF(Country = 'A', 'Something', Country) as Country
or
IF(Marks < 40,'Fail',
IF(Marks >= 40 and Marks < 50,'Pass',
IF(Marks >= 50 and Marks < 60,'Second',
IF(Marks >= 60,'First')))) as Grade
In the script:
if Condition then
....
Else
...
ENDIF
In a load:
Load
...
If(cond, true, false) as alia
...
The syntax for the If function is standardised in script and Expression level.
If( <Condition> , < Yes- Condition fulfilled> , <No- Condition not Fulfilled>)
The 'Yes' and 'No' parts can be further nested with If Conditions.
E.g. If ( 1=1, 'Yes' , 'No')
Cheers !
If Conditional Function
Syntax for using If condition in presentation layer expression definition or checking condition in a load statement is as follows
If(Condition, then, else)
Eg;
If(BankBalance>5000,'OK','Fund your account')
If conditions can be nested as follows
Eg:
If(Condition, then, if(Condition, then, if(Condition, then)))
If else is not specified, QlikView will return NULL.
If..then control statement
This forces QlikView to execute different script statements depending on one or more logical conditions
Syntax:
If condition then
statements
elseif condition then
statements
else
statements
endif
Here, elseif and else are optional. Please refer QlikView desktop help for more details and examples.
Regards,
KKR