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.

-Rob

Share

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

    Thanks.

  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.

    Thanks,
    Siva

    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.

Leave a Reply

Your email address will not be published. Required fields are marked *