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

Display Images in Text Box - Performance Issues

I have a page that is basically all image displays.  I have three displays, high (green up arrow), low (red down arrow) and no change (grey led), basically this is a quick "indicator" page on various company values.

My issue is, there are 8 teams each with 7 "indicators", so 56 objects updating based on various user input.  For example, include "other revenue category", user selects yes or no and thereby changes gross profit calculation and subsequently most, if not all, of the 56 items update.

As it stands, all my calculations and "indicators" work, however the page is ridicously slow.  I originally started with very difficult and multi-layered if/then formulas and have since spent many hours re-tooling the calculations into variables.  And regardless of the amount of rework, each of the 56 objects still has at least two if/then statements to get to the desired image value. 

UPDATE: I have since reduced each to just a high/low, thereby making each object a single if/then and the performance still has not increased. 

Since I was able to remove many of the if/then statements I expected a noticable performance gain, but now am thinking it's simply due to the amount of visible objects. 

Anyone have any thoughts on the subject?

Thanks, Dave.

18 Replies
Not applicable
Author

Attached them to the first post.  See above. 

johnw
Champion III
Champion III

Doh!

johnw
Champion III
Champion III

I'm kind of skimming so please forgive me if I miss something or get something wrong.  It looks like valinputs is just counting the number of yesses?  If so, it can be replaced with this:

=-(vinput1='Yes')-(vinput2='Yes')-(vinput3='Yes')-(vinput4='Yes')-(vinput5='Yes')

Boolean expressions evaluate to -1 for true and 0 for false, allowing us to add up the yesses this way.  It doesn't have the 'nothing' value, but that seems to only be if you somehow get something other than a yes or no in the variable.  The above interprets it as a no, which I assume will be acceptable, particularly since you should never get weird values in the yes/no variables.

As far as the rendering problems go, are you using a multi-core processor?  If so, your "perfect storm" causing the doc to fail is, I believe, a single QlikView bug that I reported maybe a year ago.  On multi-core processors, QlikView does not guarantee the order in which variables will be evaluated.  It may, for instance, send valinputs, vvalue1 and vvalue2 to three different cores, all at the same time.  The actual calculations could complete in any order, meaning that vvalue1 and vvalue2 are not necessarily updated properly.  You would be expected to see frequent but intermittent problems.  QlikTech's suggestion was keep only a single layer of calculations in variables, and that's the only thing I know to suggest to you as well.  Fortunately, using a significantly simpler expression for valinputs should make this more practical and less of a drain on CPU time.

I'm unclear what you were saying about dollar sign expansion.

Not applicable
Author

Unfortunately, the "vallinputs" is only a simple example of my production environment.  I threw that together for this test.  In reality my user inputs are converted to string values that I pass into a set analysis equation.  Basically if the user says yes on input1, the set analysis gets a string value, something like 'Other Revenue' which returns my financial information.  As the user selects more, the variable actually reads something like 'Other Revenue', 'Perm Revenue', 'Bad Debt', etc . . . . 

I use that to dynamically change my set analysis expression so that I was able to remove many layers of if/then statements from the objects and into the variables.  However I also tried moving the results of that into a table and just do a set analysis return against that table and eliminate the complexity of the formula.  Unfortunately that didn't really have any impact.

Your multi-core subject sounds as if it is the culprit.  In my production doc I have a variable that calculates the "base Gross Profit" (current year) in conjunction with the "all inputs", a second variable that uses the "all inputs" to give me an adjusted, comparative Gross Profit (let's say Budget).  As well as some other user selections that are in the mix.  Then I use those final two variables in the indicators (vvalue1 and vvalue2 in the test qvw posted in this thread).  I positive that I'm at least 2 variable layers in (maybe 3 in some places).

I found an article/blog that discussed how using dollar sign expansion can move where the calculation takes place, meaning from the variable to the object.  Basically using that line of thinking worked in this scenario, becuase it made all the variables into single layer since they were no longer calc'd at the variable level.  At least that is what the article seemed to suggest and in the latest trial it does seem to work.  But the refresh is still awful for what should be a "simple" doc.

johnw
Champion III
Champion III

Once I changed your variables to a single level, the display problem cleared up, at least on my machine (2 cores) in version 9 SR6.  So I think the bug I mentioned is very likely the problem, even if the variables themselves seem to usually get the right value (I thought I saw one fail, but I could be mistaken).  I suspect it's doing a lot of rendering before the variables refresh when using two layers of calculated variables.

Not applicable
Author

Agreed, however in real life changing those variables to single layer is going to be difficult.  Maybe a couple late nights in my future.  I'm going to have to redesign this entire page (again ).

johnw
Champion III
Champion III

Well, I suspect there's a better way to approach the whole problem, but it's difficult to know with limited information, and the time I could devote is very limited as well.

Not applicable
Author

No sweat John.  Thanks a ton for what you've given me. 

Funny how I redesigned the production doc to make my life as simple as possible for future maintenance, new additions, etc (or so I thought) by shifting the complexity from the objects into the variables.  And now I discover that QV doesn't handle it very well.

It does seem a bit shortsighted that I can't calculate on a variable within another variable.  But I guess that's just a limitation of the product.

Not applicable
Author

I want to put this out there for any one else who stumbles into this post and/or problem.  The final culprit behind what seemed to be a speed issue was actually a redering problem.  As John elaborated, there is an issue with multi-core machines and QV does not know the sequential order of the variables to be processed.  As such, when the variables are passed, they can be passed out of order and if that happens your dependent calculations may fail.

In my final result, I have three variables that build the criteria in a set analysis equation which is also stored as a variable and is what i used in my final visible object.

It goes something like this:

vMktIndicatorGPBase

=SUM({$<CATEGORY = {'GROSS PROFIT'}, DIV_NAME = {$(vMktIndicatorLTPharm)}, RECORDTYPE = {'ACTUAL'}, GLYEAR={'$(vGLYEAR)'} >} PERIODAMNT)

-SUM({$<CATEGORY = {$(vMktIndicatorOptions)}, DIV_NAME = {$(vMktIndicatorLTPharm)}, RECORDTYPE = {'ACTUAL'}, GLYEAR={'$(vGLYEAR)'} >} PERIODAMNT)

My attempt here was to dynamically build the set analysis and pass the final result to an object.  However, since QV doesn't handle nested variables well, I'll have to replace all the "outer" variables with the actual formula.

Hope all this helps someone down the road!

Dave