Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
May 10, 2022 3:21:58 PM
Feb 11, 2019 1:22:58 PM
In Qlik Sense, when there is a commented out portion of the script, if "//" is deleted and the script is saved, all the text will turn black and all syntax highlighting will be lost. If pages of the script are toggled between, a message that says "we have disabled syntax highlight to maintain performance" appears and the highlighting will come back but if previous steps are followed again,commenting will also be disabled again.
This is working as designed.
It is the current solution for dealing with deeply nested if statements. In many cases these deeply nested if blocks will cause real performance issues (crashing the browser). The best practice is to not use nested ifs when possible. The commenting/uncommenting works because we count the levels. Pretty sure 10 levels deep we trigger the perf warning. So if they comment out one and it's only 9 it won't complain.
Hi.
Is there a workaround for that? What if I need to have more than 9 iterations of nested ifs?
Thanks
Hello @GHasan
This is working as designed and no direct workaround is available. I would recommend posting about your requirement in the fitting forum to see what best practices our users are following. This would be the appropriate forum: Qlik Sense App Development.
I did some further testing (using the current SaaS Cloud version).
10 seems to still work, 11 not. E.g.:
Load *,
if( a, if (b, if(c, if(d , if( e, if (f, if(g, if(h , if(i,if(j, //if(k,
1,0 )))) )))) )) // )
as a0
resident table;
still works
BUT there is a hidden second case which I have seen where you run into this:
Load
*,
if( Text = '1' or Text = '2' or Text = '3' or Text = '4' or Text = '5' or Text = '6' or Text = '7' or Text = '8' or Text = '9' or Text = '10' or Text = '11' , 1,0 ) as a1
resident table; // also no highlighting
So OR also counts as a nested if!
In that specific case you should use match( ) or more generally prefer a mapping to avoid the deactivated syntax highlighting.