Remote include scripts

By Barry Harmsen

Got a bunch of scripts here for you, where do you want me to put them?One of the reasons why I like QlikView so much is that there are always new functions and applications to discover. Yesterday I was at a client who is a Qlik OEM partner. During lunch we discussed various uses of include scripts. The question came up if it was possible to remotely update include scripts. At the same time they didn’t want these external scripts to be viewable (they sell a solution based on QlikView, clients get the solution but the OEM owns the code). Of course, that makes things a little more complicated. The include script sits outside of QlikView in plain text, so anyone can read it. Besides that, updating an external script that sits on the client’s local server is also not a straightforward affair.

I started wondering if it might be possible to fetch an include script from a remote website. So I just tried it, and it works!* (in QlikView, Sense requires Legacy Mode to be enabled, I will let you decide if that is a good idea)

Try this one for example:


In my opinion, this opens up some interesting use cases:

  • Remote updates of scripts: I realize this is easier said than done, a QlikView app usually has more dependencies/things that need to be updated than just the script. However, for consulting companies with a big shared library of Qlik scripts for common script tasks (and any serious consulting company has these, or uses QlikView Components) this could be an excellent way to distribute/update this library. Common script tasks usually have well-defined inputs and outputs, so are relatively isolated from the rest of the script logic.
  • Securing scripts: Using an include file makes it easy to reuse and update script across applications. On the other hand, the script is visible to everyone. While I do not find this a problem, in some cases, such as the OEM example, it might be. Placing the script in a remote location and calling the include from hidden script partly solves this issue (it’s more obfuscated than secured, and only makes it a little harder to get the script. It can definitely be improved upon, but it’s a start).
  • Deliver different/parametrized versions of script: You do not need to link to an actual text file, but to something that returns a text file. This makes it possible to deliver different versions of a script to different callers, or refuse access altogether. In the example that I showed above, the include statement references a simple PHP file that includes a ‘license key’ in the query string. This key can be checked and based on whether it is valid or not a script can be returned. You could also include a ‘version number’ in the query string to fetch a particular version of the script. IMHO, lots of opportunities for ideas there.

I realize this idea is a little rough around the edges and there are obvious downsides (what if the Internet is down?), but just wanted to share it with you because I thought it was cool. Who knows where someone else will be able to take it?

I’ve created a small example which demonstrates including remotely hosted scripts, you can download it below.

Download the example

If you have any ideas for potential applications, or if you think this is a horrible idea (the thought crossed my mind), I’d like to hear from you in the comments below.


Update: One more!

Ok, so this is not a killer use case, but fun nonetheless. Calling this URL:


will return a complete Sales data model containing random data. The sales data is fetched from Mockaroo using their API. The API calls are made using my API key, which is limited to 200 calls per day, so don’t be surprised if it doesn’t work. It’s just an example though 😉 Might be useful in the future for ad-hoc QlikView/Qlik Sense demonstrations.

Download the random data example


* In hindsight, I wonder why this never occurred to me before. Probably because the Insert | Include Script dialog always opens the local filesystem, and doesn’t offer the ‘web file’ option like the file wizard does.

About The Author

Barry Harmsen

Hi there, I'm Barry and I'm a Business Intelligence Consultant at Bitmetric and based in the Netherlands. Originally from a background of 'traditional' Data Warehousing, Business Intelligence and Performance Management, for the past 10 years I have been specializing in Qlik and a more user-centric form of BI. I have done numerous QlikView and Qlik Sense implementations in many different roles and industries. In 2012 I co-authored the book QlikView 11 for Developers. You can follow me on Twitter at @meneerharmsen.


  • 1
    November 5, 2015 - 23:26 | Permalink


    Thanx for sharing!

  • 2
    Richard Ouellette
    November 7, 2015 - 15:38 | Permalink

    Is it possible to also post the remote script that resides on the remote server?

  • 5
    November 7, 2015 - 23:17 | Permalink

    Good to know!

  • 6
    November 8, 2015 - 12:52 | Permalink

    Hi Barry,

    since 2010 I wrote a Qlikview app based on the same approach you discussed in the post to be able to update the script and parametrize it…

    In my app I link an ASP webpage instead of a php, but the idea is exactly the same: so happy to see I developed the same idea of a Qlikview guru like you! wow!

    • 7
      November 8, 2015 - 21:48 | Permalink

      Hi Sherazade,

      Yes, it’s the same idea, you can use whatever language you like as long as it can return a text file containing QlikView script. As my web host only supplies PHP I’ve used that.

      Good to hear that you figured this out a long time ago already, would’ve loved to have known about this earlier. Perhaps you should start a blog? 😉 I don’t really see myself as a guru (I am actually quite allergic to people who apply that badge to themselves), just as someone who likes QlikView, happens to work with it a lot and likes to share his findings with others.

      Kind regards,

  • 8
    November 11, 2015 - 15:29 | Permalink

    Me too!

  • 9
    May 10, 2016 - 13:46 | Permalink

    Hi Barry,

    We are testing your great solution in order to inject a QlikView script into Qlik Sense. Do you have any test about this scenario?

    include or must_include is not working on QlikSense.

    Thaks in advice!

    • 10
      May 10, 2016 - 18:02 | Permalink

      Hi Antonio,

      By default, Sense doesn’t allow calls to the local filesystem (even though the file is on the web, it’s still seen as a local filesystem call). There are two ways to fix this:

      * Enable Legacy Mode, which I wouldn’t recommend. Described here:

      * Create a new connection with a link to the exact file. Call this for example RemoteInclude. The syntax then is: $(must_include=[Lib://RemoteInclude]);

      Kind regards,

      • 11
        May 11, 2016 - 11:29 | Permalink

        Hi Barry,

        That sounds great! Thanks! We will test both scenarios.

        However, we are working on an api rest that will be able to serve the scripts dinamically, based on querystring parameters. Can we use the second approach (connection link) to make calls to our api?

        That api is working on conventional QlikView, so we want to reuse it on Sense. What do you think?

        Thank you so much!

  • 12
    October 10, 2017 - 09:47 | Permalink

    Hi Barry,

    I do like this:

    Anyhow, if we copy URL and past to a browser, we can see everything…something like TRACE >>> LICENSE ACCEPTED <<<; FOR i = 1 TO 10; TRACE Remotely included script step $(i); NEXT;

    Is there any way to encrypt plain text?

  • Leave a Reply

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

    Read previous post:
    QlikView macro’s are bad!

    Last Thursday I did a presentation at the Qlik Dev Group NL about QlikView macro's. While the title Macro's are...