Skip to main content
Announcements
Talend Data Catalog 8.0 End of Support: December 31, 2024 Get Details

Syntax Highlighting is turned off in the script editor when there is a nested IF with more than 9 recursion levels

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Sonja_Bauernfeind
Digital Support
Digital Support

Syntax Highlighting is turned off in the script editor when there is a nested IF with more than 9 recursion levels

Last Update:

May 10, 2022 3:21:58 PM

Updated By:

Jamie_Gregory

Created date:

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.

 

Environment: 

 
 

Internal Investigation ID(s):

QLIK-93629
Labels (2)
Comments
GHasan
Contributor III
Contributor III

Hi.

Is there a workaround for that? What if I need to have more than 9 iterations of nested ifs? 

Thanks

Sonja_Bauernfeind
Digital Support
Digital Support

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.

john_oll
Partner - Creator
Partner - Creator

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.

Version history
Last update:
‎2022-05-10 03:21 PM
Updated by: