A while back, I blogged on Sending HTML Content via Email from Sense. What if that same HTML could be written to a web server to be picked up? What if you already had that web server available, in the shape of your Sense Enterprise Server? Read on to find out how to create data driven wall-boards and get information to users who don’t require Sense licences.

The Requirement

Qlik Sense is a web-based application which delivers interactive information to users through a web interface. One issue though, is that every user who accesses that information requires a licence. Sometimes there are users who have no interest in drilling into the data, or desire to get under the skin of the numbers, but just need some static data. Wall-boards are a perfect example of this, as typically they are on screens that can not be interacted with. Paying for a licence in these cases does not make sense.

NPrinting offers a fantastic solution for this, allowing you to schedule the creation of image files, spreadsheets and HTML, to build pseudo interactive pages that can be deployed via a website (or email, or file share etc.). NPrinting also carries a price tag though and may be overkill in some cases.

What if we could just use Sense to build dynamic pages and pass the URLs to the people who need the static data?

Well, we can.

Read on to find out how to do just that. I will also share a little time-saving trick for creating simpler URLs for your users.

Using a Content Library for HTML

The primary purpose of Content Libraries in Qlik Sense is to store images to be used as thumbnails within Sense applications. When you upload files to a Content Library they are available on a URL on your Sense server, allowing them to be used in applications. If you upload a piece of HTML this will be displayed at a URL and be rendered as a web page.

To set up your content library go into the Sense Enterprise Management Console (QMC). From here select the Content Library menu.

Location of the Content Library Menu

Once here you should see the default Content Library, any libraries which have been created by the Dev-Hub or custom libraries that you have created. Click the Create New to create a new library.

Location of Create New button

Give the library the name HTML and click Apply.

Set the properties of the Content Library

Once your library is created, ensure it is highlighted (with a black bar) and then click Edit or double-click. Here you can set some properties for the library, including whether it is available for users within Sense. This does not come into play, though, with regards to files being available on the site. Users will need to be authenticated with Sense though in order to view any files.

From here we want to upload a file, so click the Contents menu on the right.

Location of the Contents Menu

Our goal here is to have dynamically updating HTML, being written from the Sense load script. Before we can do this, however, we need to get an entry for any files we are going to be writing in the Sense database. In order to do this, we need to upload a stub of the file to the Content Library. If you just have a static file (say a help page for your app) uploading it here is all you need to do. If it’s dynamic, you will need to carry on with the steps below.

To upload the file, click the Upload button, click Choose Files, select the file and then click Upload again.

How to upload to Content Library

When you see the uploaded files you should also see columns which show you where the files have gone on your Server and where they are available as a URL.

So, if we upload a file called wallboard.html users will be able to get to that file at https://your.server.name/content/HTML/wallboard.html. Give this a try to check that it has worked okay.

The file is written to a location shown in the QMC as %StaticContentRoot%\Content\HTML\wallboard.html. The %StaticContentRoot% part refers to a location within your Sense share, which would have been created when the server was installed. If you don’t know where this share is, find an administrator who does. Under that share will be the path \StaticContent\Content\HTML\, and in that folder you will find your file.

Creating a Connection to the Content Library

All reading and writing to locations in the Load Script is done via libraries (unless you are happy with the risks of enabling Legacy Mode). You will therefore need to create a Folder connection to the HTML Content Library. This needs to be done within the Load Script Editor of an App.

Click on Create Connection and then select the type of Folder.

Create Folder Type Library

The path needs to be the path to the HTML folder which is referenced above (note the drive letters in this case refer to the drives in the server, not your machine). Give the connection the name HTML. When complete select Create.

Specify content folder location

A quick tip, not entirely related to this post: once you have created your connection go into Data Connections in the QMC. Here you can find the library you have just created and rename it, so that it doesn’t have the username of the person who created the Library in the name. This makes for tidier load scripts, less typing and less chance of errors slipping into scripts. You will need to refresh the browser page with your load script before you can use the newly named library.

Once the library is set up correctly we can create dynamic code to update the HTML file we have created in this section.

Building Your HTML

Compiling information in the Qlik Load Script and then writing that to a file is something that I covered in my blog post Sending Data From the Qlik Load Script. In this case we were building a table to go in the body of an email, the same process can be used to build a static web page.

Rather than re-writing the instructions for creating the HTML I will refer you to the previous post. You can ignore anything to do with QWC, SMTP and encoding of strings. You can therefore scroll straight on down to the section titled Get Some Data.

The post talks you through obtaining some data, aggregating that, making it into HTML and writing to a file. The HTML you have in the header will be different (you can use a link to CSS, for instance), but other than that the process will be the same.

When you come to write the table you have built, STORE it to the HTML Library you created in the last section.

Once you have re-written your HTML check that it has refreshed using the URL from the previous section.

Improving Your Output

Sending text-based data, and styling are all relatively straight forward to work out. We use this technique to provide clients with a HTML-based wallboard to keep tabs on the status of their Sense server. The output looks like this:

Qlik Sense Status Monitor

With a bit of knowledge around HTML and CSS you should be able to create charts in the output you produce also. When I posted the blog post on sending data, Héctor Muñoz suggested a mechanism for getting charts built on the fly. He describes how to achieve this in his blog post here: https://blog.datanrock.com/2018/12/05/send-charts-from-qlik-load-script.

In the header of the HTML you are writing you will want to put a HTML tag to get the page to refresh. This is simply achieved by adding the following tag to the header of the HTML you write out:

<title>Automated Sense Wall-Board</title>
<meta http-equiv = "refresh" content = "60; url = https://your.sense.site/content/html/wallboard.html" />


This will refresh the output every sixty seconds, so as soon as Sense writes a new page it will be picked up.

By putting together all these pieces you can have a constantly updating page to sit on a user’s screen or an unattended wall-board. All without consuming one of your Sense licences.

Quick Sense Web Redirect Hack

Now we have a web server to hand, and the code above to do a redirect, why not use this to create short-cuts to apps and pages within your Sense site. To do this simply create a HTML file with a short name, with the header as above. In the place of the URL put the URL of the app you want to redirect to and swap the 60 out for a zero. Your much shorter URL will read like https://your.sense.site/content/html/kpi.html, but it will go straight to a page of analysis (or even a single chart) which would otherwise require two large GUIDs in the URL to get to.

Set up short-cut redirects for all the key pieces of analysis contained in your site to allow sending of shortened URLs around your business, making it much more efficient for staff to find the numbers they are looking for.