Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Is there a limit of lines of code that an object ("indicator") can execute in order to avoid performance problems?

Hi,

Please help me!

I am having performance problems using the object "indicator".

I have the following code inside of the object:

if(

if(isnull($(vLI($1,'P010','E002'))) and isnull($(vLS($1,'P010','E002'))),0,

if(isnull($(vLI($1,'P010','E002'))),if($(vValor($1,'P010','E002')) <= $(vLS($1,'P010','E002')),0,1),

if(isnull($(vLS($1,'P010','E002'))),if($(vValor($1,'P010','E002')) >= $(vLI($1,'P010','E002')),0,1),

if($(vValor($1,'P010','E002')) >= $(vLI($1,'P010','E002')) and $(vValor($1,'P010','E002')) <= $(vLS($1,'P010','E002')),0,1))))>0 or

if(isnull($(vLI($1,'P010','E003'))) and isnull($(vLS($1,'P010','E003'))),0,

if(isnull($(vLI($1,'P010','E003'))),if($(vValor($1,'P010','E003')) <= $(vLS($1,'P010','E003')),0,1),

if(isnull($(vLS($1,'P010','E003'))),if($(vValor($1,'P010','E003')) >= $(vLI($1,'P010','E003')),0,1),

if($(vValor($1,'P010','E003')) >= $(vLI($1,'P010','E003')) and $(vValor($1,'P010','E003')) <= $(vLS($1,'P010','E003')),0,1))))>0

... (500 more pieces of code silmilar to the 2 showed above)

,1,0)

each piece of code compares variables with limits and in case the value of the variable is out of limits we get "1", if not we get "0".

The problem is that the object takes too much time to refresh the result. I am using "or" operator to join the pieces of code because if nested takes even more time to refresh the object.

Is there a limit of lines of code that an object ("indicator") can execute in order to avoid performance problems?  ...because when i distribute the lines of code in more indicators, they are refreshed significantly faster that when i use only one object.

Any idea will be great. Thank you.

3 Replies
Siva_Sankar
Master II
Master II

Linda,

Obviously there will be performance issue if there are many if else statements especially in the front end.

Better to bring this in script side or try using set analysis in front end.

Regards,

Siva

marcus_sommer

Indeed there is a limit of 99 nested if-loops but this isn't a real limit because nested if-constructs are a huge performance-killer and the development and maintaining of such constructs is a nightmare - so that's very unpractically to use heavily nested if-loops.

And quite often there are other solutions possible. For this have a look here:

Re: Multiple nested if statements

Re: Pick Match vs Nested If Performance

- Marcus

Not applicable
Author

Hi Siva, thank u for your response.

I can't put the logic in the script because it have to be dinamically, when the user select date filters, the objects have to be recalculated at the moment.

I would like to ask u something please. Are you agree with me, that objects do not support too much operations (execution of lines of code)? if so, do you know what is the limit? I am testing and when I have less than 150 operations, it works fine, but in my case I have 500 operations in the object, that's why I am having performance problems I guess. What do you think?