Document Open Processing

Summary: QlikView OnOpen Document triggers fire after the saved opening sheet is calculated.  That sheet may have some heavy calculations that slow the user’s opening experience.

Maybe you already know this, maybe not.

I commonly use a Document OnOpen trigger to make sure that my Document opens on the correct sheet.  I do this because I can be lazy or sloppy during development and save the document with the wrong sheet open.  What ever I saved with becomes the opening sheet.  I hate to reinstall an app just because I saved on the wrong sheet.

Are there any “gotchas” with doing things this way?

I just noticed (after all these years) that even if my OnOpen trigger opens a trivial or empty sheet, my document can take a long time to open.  Why? Because the data requires a lot of decompression? No.

It’s because objects on the saved sheet are getting calculated and then the OnOpen Activate Sheet is being applied!  If my saved sheet has some heavy objects, I may wait a while for those calculations to complete before the Activate Sheet runs and only then do I see output.

This is also true if I use a “Select in Field” OnOpen trigger to reduce my set to something like the current month.  The trigger fires after opening sheet charts are calculated with the saved state — which is generally all data.

Of course I can leverage this behavior by making sure I save my document with selections that represent a small set, and then refine using an OnOpen trigger.



11 thoughts on “Document Open Processing”

  1. I use the on post reload instead. Then it all happens before the user opens it. Also no issues with Ajax not running certain things.

  2. Rob, now I understood why some models are too slow to open (with or without data compression).

    In my mind, first run triggers and then do calculations.

    Not doing calculations before and after triggers…waste of resource.


  3. Hi Rob,

    I came across similar kind of performance issue especially on open because of triggers.

    You mentioned
    “Of course I can leverage this behavior by making sure I save my document with selections that represent a small set, and then refine using an OnOpen trigger.”

    How can you do when the first page is global page and the calculation of metrics is aggregation of large data sets instead of a small set.


    1. The initial opening calculation is done using the selections in force when the document was saved. What I meant was that if you saved your document with selections that represented a small set of data — like a single customer — the open could be fast.

      1. Ok. I have a dashboard with opening page with list of countries with Sales, Profit, Revenue, Margin etc for particular period, and a chart with list of top 15 customers profit and margin. On open there is a trigger to show an input box with variable set as Max Profit, Min Profit for that period. It is taking time to open the sheet because trigger does aggregation calc to calculate margin %. I cant calculate pre aggregation, so it does on the fly calc and taking time. Do you have any hint to tackle this issue.

        1. I’m not totally following your inputbox/trigger flow, but here’s the recommended flow to optimize the opening time and avoid unnecessary calculation.
          1. Save the document on a trivial (little or no calculation) sheet such as an Introduction sheet.
          2. Use the OnOpen trigger to:
          a) Make the selections you want.
          b) Active the sheet you want.

          If even this scenario is taking a long time, and you want to speed it up for the first user, use one of the “cache warming” (search the community) techniques to do the first open. The simplest method is to use an automated HTTP tool like CURL to send the URL to the server.

  4. Hi guru’s, in QV12 the Trigger On Open Activate Sheet SH01 doesn’t seem to work in the AccessPoint (we use Ajax ZFP). When I don’t leave the dashboard using the Close button (top right corner of AccessPoint) it seems to remember the sheet I last used, rather than triggering the On Open Activate Sheet SH01! When I do use the Close button QV opens on SH01 when reopening the dashboard. How can I force the use of the Trigger On Open Activate Sheet?

    1. What you are describing is the expected behavior — return to last sheet and state — when returning to an active session or using session recovery. An active session will be there unless the user explicitly closes or the session times out. After that, if session recovery is active, the session state will be remembered unless the user uses the “remove last document state” button in Access Point. If you want to turn off Session Recovery altogether you can do so in the QMC System -> Qlik View Server -> Documents

      1. Rob, I do not recall this being the case in QV 11.2. Any insight on if this is a change in QV 12?

      2. Hi Rob, thnx for your answer, that’s quite helpful in understanding the issue, which is actually expected behaviour 😉
        Are you aware of any possibility in ‘overruling’ the session recovery option set on server level? For the majority of our users and dashboards this is a helpful feature, but for one specific dashboard I’m looking for an option to ‘switch it off’. The QMC is not offering that at document level I’m afraid. Thanks again for taking time to answer my question.

        Kind regards

  5. You said the document is going to the correct sheet if you use the close button? If so, that indicates that you coming back into an active session when you get the wrong sheet. There is a document extension you can implement — per qvw — that will close the session when the browser window is closed. That should give the equivalent behavior to using the close button.

Leave a Reply

Your email address will not be published.