18 Replies Latest reply: Jun 16, 2011 4:35 PM by sirguise RSS

    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.

        • Display Images in Text Box - Performance Issues
          John Witherspoon

          I don't think the images are the problem based on some quick testing.  I just built a page with 150 random up or down arrows selected with an if().  It takes about 1/3 of a second to render them on my old computer.  With 1/3 the images and likely a faster computer, I wouldn't expect you to have any problems as a result of the images themselves.

           

          It's easy enough to test, though.  Clone the tab and change all the text box representation to text instead of image on the general tab in the properties.  Does the new tab render quickly or just as slowly?  If quickly, then the problem probably IS the images.  If just as slowly, your problem probably lies elsewhere.

            • Re: Display Images in Text Box - Performance Issues

              Thanks John, very helpful indeed.

               

              Interestingly I have an input field on this page so we can change back and forth between the numeric (or text display) and the arrow image.  As text, the rendering is nearly as bad.  This is partly why I thought the problem was more about the count of active items, not necessarily text vs image (though that had crossed my mind as well).

               

              I've also recreated your test and have started loading in the other factors.  For example each arrow has a comparative on the display (to hide when we choose to view the text representation), each has a caption which shows the % change in conjunction with the arrow image, etc.

               

              So far, nothing seems to worsen the speed on the test which gets me back to where the chasing of my tail began in the first place, the calculations.  And frankly at this point I'm at a loss as to how to accelerate them any more.  ARGH!

                • Display Images in Text Box - Performance Issues

                  Hey John -

                   

                  So let me put this out there, I'm no programmer (or even IT), I'm an accountant.  But I dabble in this stuff because I have a knack for it.  So I'll say up front there is a real chance there is a better way to do any of this stuff.

                   

                  With that understanding out there, I've attached a test qvw and a word doc.  This qvw is essentially replicating the malfunctions I'm experiencing in my production document. 

                   

                  Note that when comparing the word doc and qvw, the first three rows of image objects all have the same formula, except that not all of them are giving the same result.  Basically the qvw doc is failing part way through the render.  If you play around with changing the inputs 1-5 you'll get similar results, though not consistently.

                   

                  Also look at all of the variables, I have a pretty nasty if/then variable called "vallinputs" which evaluates all 5 user inputs to a single output string.  This is also replicating my production doc in that all the inputs are aggregated to a single result which I use inside my conditional image statements.

                   

                  In production, the rendering is not only failing on updating all values, but also has the previously mentioned speed problems.  As your test helped proved out I'm now convinced that is more to do with the ability of the variables and calculations.

                   

                  Any thoughts on perhaps changing up the way I'm handling the inputs or any thoughts over why the doc is failing?

                   

                  Thanks again, Dave.

                    • Display Images in Text Box - Performance Issues

                      Perhaps I should look at adding another sql table that has the values for the user inputs.  I can then change my "ugly" variable into a set analysis statement that simply looks up the value rather than using a 32 nested if/then  statement.

                       

                      Thoughts?

                        • Display Images in Text Box - Performance Issues

                          Well, that did make the test document work a little better, but still not 100%.  There are still objects that are returning bad values.

                            • Display Images in Text Box - Performance Issues

                              Interestingly (or perhaps oddly), it seems that the issue isn't necessarily the calculations, but the screen refreshing.  I've taken my original production document, removed 2/3 of the objects from the page in question and still get the same issue.  Two things are occuring, speed still seems slow for the amount happening on the page and several of the items simply don't update (or refresh) as selections are made.  So I've taken the formulas behind those objects and broken them into all their parts in seperate text objects to confirm they are all working and they are.

                               

                              In addition I've added just one extra text object.  When the doc has items fail, I open the properties of that extra item, change the caption, click ok, it updates and then the rest of the page "catches up".  It's like the refresh is getting stuck.

                               

                              Have I created the perfect storm of variables, set analysis and amount of items that I'm somehow causing the doc to fail?  I mean, this document is really not that complex (I don't think), yet here I am. 

                               

                              Anyone care to chime in?

                                • Re: Display Images in Text Box - Performance Issues

                                  Oh and this is happening in both my production (version 8.5) and test (version 10).

                                   

                                  I have also since removed all objects, and looking only at the variable breakdowns in text boxes.  I have to sets of items, one text box with the variable, another with 5 text boxes that break down all the components of the variable.  When changing the inputs, the 5 boxes work perfectly, however the variable is intermittently failing.  Again, as above, grab the box, move it around and it updates, so the variable value is actually there, but the refresh isn't fully processing.

                                    • Re: Display Images in Text Box - Performance Issues

                                      Since I'm now basically grapsing at straws here, I've started tinkering with the dollar sign expansion.  Since the objects are not rendering when the variable is being calculated, I've move the burden to the object (which frankly sucks for performance), but seems to have solved the rendering issue since now all the individual items are recalculating the variable.

                                       

                                      Anyone have any input here?  So far this is the best answer I have and it's not really a very good one.

                              • Re: Display Images in Text Box - Performance Issues
                                John Witherspoon

                                sirguise wrote:

                                 

                                So let me put this out there, I'm no programmer (or even IT), I'm an accountant.  But I dabble in this stuff because I have a knack for it.  So I'll say up front there is a real chance there is a better way to do any of this stuff.

                                 

                                With that understanding out there, I've attached a test qvw and a word doc.  This qvw is essentially replicating the malfunctions I'm experiencing in my production document. 


                                And I'm no accountant, but I dabble in it.  I've designed and/or written a lot of custom accounting software over the years.

                                 

                                Anyway, your attachments appear to be missing.  Those would probably help.

                                  • Re: Display Images in Text Box - Performance Issues

                                    Attached them to the first post.  See above. 

                                        • Re: Display Images in Text Box - Performance Issues
                                          John Witherspoon

                                          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.

                                            • Re: Display Images in Text Box - Performance Issues

                                              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.

                                              • Re: Display Images in Text Box - Performance Issues
                                                John Witherspoon

                                                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.

                                                  • Re: Display Images in Text Box - Performance Issues

                                                    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 ).

                                                      • Re: Display Images in Text Box - Performance Issues
                                                        John Witherspoon

                                                        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.

                                                          • Re: Display Images in Text Box - Performance Issues

                                                            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.

                                                              • Re: Display Images in Text Box - Performance Issues

                                                                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