Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
Quick one. I have multiple nested ifs statement, say about 20 statements. I do realise that I shouldn't have that many if statements, so really looking for a better way.
QlikView seems to recognise the first 10 or so statements and then doesn't recognise the other statements.
Is there a way to rewrite this or an alternative to get this to work?
Any help will be appreciated.
Like:
Pick(Match(Field, Value1, Value2, ...) , Result1, Result2, ...)
Thanks Tresesco.
Even with the pick(match), it still stops at the 11th value. Any other ideas?
I never heard of this limitation. And after testing in an app, it does confirm otherwise. Please check the sample qvw. I tried till 12th level - and worked fine.
Hi,
Pick works for 'n' number of conditions.
For eg:
LOAD
RowNo() as R
AutoGenerate 20;
Take St. table with dimension as R
and expr as
Pick(
Match(R,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20),
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
Thanks,
Jagan
Razor,
What does your massive If statement do? Can you post it?
There are options,
You could use wildmatch() if you are pattern matching
Example of my situation cut down.
join (data) load Tick_no,wildmatch(Description,
'*filesystem is now*',
'Error(s) written to /var/adm/messages *',
'The Qlikview Server service terminated unexpectedly.*',
'Possible performance problem*',
'*java.lang.OutOfMemoryError. Restart*',
'* has hung threads. Contact *' ) as Pattern_match resident data;
LOAD * INLINE [
Pattern_match, Pattern Description
0, N/A
1, filesystem full
2, Var/ADM messages
3, Qlikview service Terminated
4, Performance Alert
5, Java OOM
6, Webserver server down or hung
];
My application has 30+ lines in the table.
Richard
Match()
WildMatch()
MixMatch()
Thanks for all the responses so far.
I have included a sample of my if and pick match expressions that stop after the 10th or 11th option
if(Col1 ='Chart1', 'Chart1',
if(View ='Chart2', 'Chart2',
if(View ='Chart3', 'Chart3',
if(View ='Chart4', 'Chart4',
if(View ='Chart5', 'Chart5',
if(View ='Chart6', 'Chart6',
if(View ='Chart7', 'Chart7',
if(View ='Chart8', 'Chart8',
if(View ='Chart9', 'Chart9',
if(View ='Chart10', 'Chart10',
if(View ='Chart11', 'Chart11',
if(View ='Chart12', 'Chart12',
if(View ='Chart13', 'Chart13',
if(View ='Chart14', 'Chart14',
if(View ='Chart15', 'Chart15'
)))))))))))))))
Pick(Match(View, 'Chart1','Chart2', 'Chart3', 'Chart4', 'Chart5', 'Chart6', 'Chart7', 'Chart8', 'Chart9', 'Chart10', 'Chart11', 'Chart12', 'Chart13', 'Chart14', 'Chart15', 'Chart16', 'Chart17') ,
'Chart1','Chart2', 'Chart3', 'Chart4', 'Chart5', 'Chart6', 'Chart7', 'Chart8', 'Chart9', 'Chart10', 'Chart11', 'Chart12', 'Chart13', 'Chart14', 'Chart15', 'Chart16', 'Chart17') as Test_Col1
Thanks,
Wow. Can you explain what you are trying to do? Is this function on a "Calculation Condition" to display a chart only when conditions are met.
There may be a better way.
Richard
Ignore the labels I used, they are just for illustration.
What I am trying to do is to create a list in my script that I can use as a dropdown list in my front end, so users can navigate from page to page in a neat and tidy way.
Works fine for the frist 10 or 11, but not after it