So, we all know that QlikView only spends resources on calculating objects when they are visible, right? WRONG! If you have many hidden objects on a page, check out the Sheet Properties, tab Objects, and see that the hidden objects still draw substantial Calc Time, even if they remained hidden from the very beginning.
We knew that Show/hide conditions, Calculation Conditions and calculated Captions are being recalculated with every click, but this time I’m pretty sure that the objects are being fully calculated while they are hidden.
So, the good news is — when the object becomes visible, it won’t require any more resources to get calculated. The not-so-good news is that if you have many hidden objects on the page, the initial wait time might be too long, even if the users will never need to navigate to those hidden objects.
We ended up with a work-around. We duplicated our “Show Conditions” within the “Calculation Conditions”, to ensure that the objects are not getting calculated until they become visible. The initial wait time was visibly improved.
If you only have a few objects to worry about, you can do it manually. If your dashboard has many tabs, and each tab has many charts, you might need some automation. Below is a simple macro that does the job, with just a few caveats, that might need your manual attention:
1. If your Calculation Condition has a comment, marked with two slash signs “//”, the combined solution may not work.
2. If your Show Condition is “Always”, and at the same time there is a Show/Hide condition (grayed out), it will get populated anyway. I only discovered this glitch recently. I will post an update to the script as soon as I have time to clean it up…
Use “at your own risk” 🙂
Appreciate everyone’s thoughts.
‘===========================================================
sub setCalcCond
on error resume next
for sheets = 0 to ActiveDocument.NoOfSheets – 1
set ss= ActiveDocument.GetSheet(sheets)
Objects = ss.GetSheetObjects
For i = lBound(Objects) To uBound(Objects)
If (Objects(i).GetObjectType >= 10 and Objects(i).GetObjectType <=23) or Objects(i).GetObjectType =27 or Objects(i).GetObjectType >= 28 or Objects(i).GetObjectType >= 37 Then ‘Charts
set chart = Objects(i)
set cp = chart.GetProperties
if len(trim(cp.GraphLayout.Frame.Show.Expression.v)) > 0 then ‘ IF Show Condition Exists
if len(trim(cp.EvaluationCondition.v)) >0 then ‘ IF Calc Condition already exists
cp.EvaluationCondition.v = “(” & cp.EvaluationCondition.v & “) & (” & cp.GraphLayout.Frame.Show.Expression.v & “)”
else
cp.EvaluationCondition.v = cp.GraphLayout.Frame.Show.Expression.v
end if
end if
chart.SetProperties (cp)
end if
next
next
end sub
‘================================================
0 Comments
Hey, what version of QlikView are you observing this behavior on?
I have seen something interesting things with hidden objects in the past. For example, a web browser will create scrollbars if hidden objects are outside the window, even if they are hidden.
However, I haven’t seen them have calc times, and I also have hidden very resource intensive charts before that had long calculation times when shown.
Currently I am running QV11SR2, but I haven’t done any tests since reading this post.
Thanks,
Speros
Hi Speros,
thank you for your comment. I observed this behavior in the past, on earlier versions, and most recently, on ver. 11 SR1. I don’t think it’s a version-specific issue. Would be interesting to see any other observations about this topic…
thanks!
Oleg
It was corrected in QV11.2 SR4. Now hidden objects do not calculate.
Hi Oleg
I’m so glad I found this article, I’ve been experiencing exactly what you’ve described. I have one worksheet with many conditional objects (30+ objects) and was finding initial page load times were extreme (up to 30 secs!). Initially i thought too it was the time it took for the page to just calculate the Layout Conditional expressions ,however these are simply looking at variable values (to check what a user wants to look at) so should have been really quick so something was just not right.
On a very similar note, using a container object, could this also be calculating all objects in the container? I think we’re OK on containers but it would be interesting if anyone’s experienced issues with these too.
I will test out your Calculation Condition and post my results.
FYI, I’m using QV11.2 SR2 so this issue still exists in the latest version.
thanks
Derek
Hi Derek,
thank you for your comment, I’m glad I’m not the only one experiencing those issues. From my experience, all the objects in a container are also being calculated before they become visible. Please post the results of your testing. After publishing those findings, I had a hard time recreating the same symptoms again, so I’d be most curious to see what problems are experienced by others.
best,
Oleg
Dear All
FYI – Just revised my app with the calculation conditions and it worked a treat, refresh time is now less than a second (what I expected to refresh the unhidden object).
Can’t wait to install this new version onto the production server as it’s been a major performance issue.
Cheers Oleg for this great insight!
Derek
Hi Derek,
thanks for your input. Glad it was helpful for you!
Oleg
Hello,
If you have many expressions and many dimensions in a single chart, with conditionnal dimensions and condition on expression as well (all conditions based on variables), will Qlikview calculate all possibilities or just the current one ?
If it does calculate everything, will your script correct that ?
Regards,
Charles.
Hi Charles,
thank you for your question. First, let me explain that the problem described in this pretty old post, was a bug, and it was fixed since then.
To answer your question, – when you have many conditional Dimensions and Expressions, only those that are enabled at the moment, will get calculated. Those that should be disabled, will not be. Just keep in mind that the calculation conditions themselves will get re-evaluated with every click, so if you have many of those, they will eventually add up and impact performance.
Are you experiencing performance slow-downs? I’d be happy to discuss the problem with you.
best,
Oleg Troyansky