Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All
In some programming languages its possible to write an IF statement with lots of condition as follows :
IF (gl_account = '62100' AND
gl_account = '62300' AND
gl_account = '62140' AND
gl_account = '66100' AND
gl_account = '67100' AND
gl_account = '62100' AND
gl_account = '61290' AND
gl_account = '62300' AND
gl_account = '62200' ) THEN
Do_Some_Job();
END IF;
But in QlikView I have to write the above statement as below :
if (gl_account = '62100' AND gl_account = '62300' AND gl_account = '62140' AND gl_account = '66100' AND gl_account = '67100' AND gl_account = '62100' AND gl_account = '61290' AND gl_account = '62300' AND gl_account = '62200' ) then
Do_Some_Job();
end if;
I would like to know if its possible to break the condition of IF statement into seperate lines for readability purposes. Is this possible?
Many thanks
MutliView
No, it is not possible in the load script unfortunately.
Thank you for your response.
I did not mean inside LOAD statement, but outside it.
E.g.
LOAD statment;
x = peek(...);
if (x = '51' or x = '2' or x = '3' or x = '64' or x = '5' or x = '6' or x = '7' or x = '8' or x = '9' or x = '10' or x = '11' or x = '12' or x = '103' or x = '14' or x = '175' or x = '16' or x = '157' or x = '18' or x = '19'.....etc)
I need to write the above code as below :
LOAD statment;
x = peek(...);
if (x = '51' or
x = '2' or
x='3' or
x='64' or
x='5' or
.... etc)
The aim is write a readable code!
Regards
MultiView
Hi,
As of now this cannot be done in edit script dialog.Better create an idea in the idea section which will consider by qlikview in next release.
Celambarasan
Yes
that was what I thought you meant:,
I wrote "in the load script" (as opposed to in a chart or table or another gui element).
In the load script it seems not possible to break an if statement into several lines (I have not seen that documented though)
(In a load statement it is possible however...)
Hi
You can use the following in script and in expressions:
If(Match(gl_account, '62100', '62300', '62140',......) > 0, <expression if match>, <expression if not match>)
Or (in script):
If Match(gl_account, ....) > 0 Then
Do something;
End If
If you have a variable containing the comma separated, quoted list:
If(Match(gl_account, $(vAccountList)) > 0, .....)
Regards
Jonathan
Thank you Jonathan, Gandal and Celambarasan for your input. I have created this as an idea. Let us hope it will be available in the next version / release.
For the time being I am using Match statement to improve the readability.
Regards
MultiView