A new version of my Chrome extension Add Sense is now available. If you’ve already installed an older version it should be updated automatically, if not you’ll find it here.
App box moved
Probably the first thng you will notice is that the app info box now has moved, from bottom right corner to top middle. The old placement blocked som parts of the Qlik Sense UI, hopefully the new one works better.
More sheet info
The sheet info box now has some more info, like if the sheet is published or not, and if you can modify it. One of the mistakes I’ve made most in Qlik Sense app development is that I forget publishing a sheet before publishing the app. This is a reminder to help you avoid that mistake.
Reintroducing ‘Enable copy’
A few versions ago I made a menu alternative to help you with use copy and paste in Qlik Sense. I wasn’t totally satisfied with how this worked, so in a previous version I removed the ‘Enable copy’ feature. But it seems like users used that, in ways I didn’t think of, so now it’s back again.
Property panel definition
Lastly I’ve added a small new feature: if you’re in advanced edit mode and the property panel is visible, you will be able to see it’s definition. That can help you if your property panel does not work as you expected.
One of the recent new features in Qlik Sense is the ability to add filters to charts, filters that applies only to the chart they are included in, not other charts. So far this is only available n Qlik Sense Clod. (Help is available here)
It has always been possible to filter data in a chart, but setting it up has been more complicated. The new feature makes it much easier and more straightforward, so it is surely a feature that will be welcomed.
Setting it up
To try this I’ll use a copy of the Demo App – Beginner’s tutorial that’s available in QlikSense Cloud If you want to follow along, open it in Qlik Sense Cloud and then make a copy of the sheet ‘ Product details’. Then click on ‘Edit sheet’ in your new sheet.
The filter option is only available in the new authoring mode, so make sure you’r not in the old one (called ‘Advanced options’). I’ll be using the chart ‘Sales and margin by Product Group’ but since that is actually a master object, and you can’t use the new authoring mode on master objects, I’ll firts have to unlink it, to make it no longer a master object. Once that is done, we’re ready to go.
Adding a filter
Filters are based on Qlik set expressions, but do not fear, there is help available to create the expressions. To add filters you use this little area:
First step is to enter the field namn (no, you cannot use dimensions). Do that, either by clicking Add and then searching for the field namn or by dragging and dropping the ‘Region’ field and you get a dialog like this:
Just select one or more regions and we are done:
To verify that it works, end edit mode and make some selections in the region field. Notice how the values in the other charts change, but not the values in our filtered chart, they will still be showing the values in the reion(s) we set in the filter (in my case Nordic). So far so good.
What does the filter affect??
But exactly what does the filter affect? It surely affects the data in the chart itself, but what about other expressions, like dynamic titles etc? Let’s try. Change the title of the chart to (you will probably need Advancd options for this):
=’Sales and Margin by Product Group. Total: ‘ & Sum(Sales)
And now you will have a sum added to your chart title. Switch to analysis mode again, and make some selections in the Region field. Notice that the sum in the title changes, so the filter does not affect the title.
The filter will only affect chart data, not dynamic titles etc. That’s important to be aware of if you are using dynamic titles.
Displaying the filter to users
As you might have noticed Qlik Sense shows the filter at the bottom of the visualization. That works pretty well in this case, but in many Qlik data models you have flags with name that are not so user friendly, or you might have fieldnames with prefixes or more cmplicated filters. If that is the case you can enter your own describing text as a footnote to the chart, like this:
And you will get your own text instead of the default one:
Behind the scenes
If you take a look at the properties of your visualization (I use my own Chrome extension for this) you can find your filters in their own structure:
Using this structure Qlik Sense then generates the actual set expression (qContextSetExpression) that is used:
A new version of my Chrome extension Add Sense is now on it’s way out. There is only one new feature in it: measures and dimensions are now validated, and if there is an error, you’ll see it in the list of measures / dimensions.
If you, like me, often start a new app by copying an old one, you might by accident have published an app with invalid measures and/or dimensions. The new feature helps you find thos, so you can fix or remove them. Also pretty useful if you’ve made changes to the data model in the app.
You don’t need to do anything to get the new version, Chrome will update automatically.
Add Sense Chrome version 2.0.0 is now available in the Chrome web store. If you already installed the previous version it should be upgraded automatically.
The main change is that the extension now uses Chrome manifest version 3, a change that was needed since version 2 will soon no longer be supported. As a user that change will not mean much. There are however some other changes too:
if you use many Qlik Sense objects in your page numbers with more than 2 digits will work better
the Active objects list has been updated, number of currently active objects are now displayed in the header, if the are not valid you will see that
the small boxes in the page can now be closed to avoid clutter
ODAG objects work better
the properties button in Active Objects has been corrected
Version 1.3.0 of my Chrome Extension Add Sense is now available here. If you already have it installed, you should get the update automatically. These are the changes
Changed icon set
The extension now uses Qlik’s Leonardo UI instead of material design icons. The loading of Material Design icons does not work without configuration changes in Qlik’s cloud products, while Leonardo UI is already loaded.
Fixed bug when properties where treated like HTML elements
Sometimes expressions containing set analysis where destroyed in the tool. Mostly this happened when there was a letter immediately after the < character. That has now been fixed.
If the visualization on screen is in the library, you previously only got the link (containing the id of the master visualization) in the property popup. Now you get the master objects properties.
The default filename when you save properties to file now contains the id of the visualization. You can still use another filename if you want to.
A new version of my Chrome extension for Qlik Sense, Add Sense, is now available in Chrome Web Store. This is a pretty big version, actually that’s why it has number 1.2.1, because a bug sneaked into 1.2.0 which I had to fix.
New app level operations
You reach the new functions from the app popup box:
In fact, most of the buttons are new. From the left to the right they are used for:
showing the script
listing the tables
exploring the data model (in Catwalk)
listing extensions used
listing active objects
A number of the new functions helps you with the data model. You can see what tables are defined in the app, and list dimensions and measures (and copy their definition into a program of your choice, like Excel or something). But perhaps the best new function is the link to Catwalk. Click on the compass icon, and it will open Catwalk with your current app:
If you don’t know what Catwalk is it’s time to get to know it knopw. It’s an open source tool from Qlik that helps you explore the data model of a Qlik Sense app. If it doesn’t work on your server, you might need to whitelist it. Check the documentation! Originally I planned to do some visualization of the data model, but I realized that I cannot make anything better than Catwalk, so why not reuse it.
List all active objects
The Add Sense extension uses Angular and some CSS selectors to find Qlik objects in your page, whether it’s the standard Qlik Sense client or a mashup. This only works for visualizations that are either Qlik Sense standard visualizations or extensions built with the traditional Angular-based method. But in a custom built web app using Qlik you might choose to visualize the data in some other way. Qlik Sense objects used this way have previously not been available in Add Sense, you could not check their properties, monitor recalculation times etc.
With the new function to list all active objects that has changed. While the little boxes showed on the page start from the HTML DOM and Angular scopes, this function uses enigmajs and lists all objects active in the enigmajs session. It might look something like this:
It still needs to find the enigmajs session, which might not work in all cases. If you want to use the extension for a case where it does not work, please let me know, you might be able to fix that with just a very small change.
Dimensions and measures
The extension can now also list dimensions and measures.
You can use the copy function in the dialog to copy the contants to the clipboard and then into application of your choice, like Excel etc.
And that’s it for the new functions. Please let me know if there is anything you are missing.
As I wrote in Part 1 Chrome Developer tools is perhaps the most important tool for a Qlik Sense extension developer. Some important points in part 1:
you should turn caching off in the network tab, and keep developer tools open to make sure files are not cached
Qlik Sense client catches program errors in your extension, so if you need to see them temporarily check the box ‘Pause on caught exceptions’. You can’t keep this box checked all the time though.
In this post we will continue with some more useful stuff.
Checking web socket traffic
As you probably know communication with the Qlik Engine is over web sockets. You find the web socket in the Network tab, just click on WS and you will find it. Click on the websocket and then on messages, and you will see the communcation, something like this:
Lots of information, lots of transactions. Some things you should know:
messages from client to server has a dark background, messages from server to client a white background
all messages are in JSON format
if you click on a message it will be displayed in a format that’s easier to read in the area below
you can filter messages by typing in text in the field where it says ‘Enter regex..’
Connect request and reply
What you see in the web socket log is simply a list of all messages sent and received, in chronological order. Since commands are processed in paralell, the reply for a specific request might not at all be anywhere near the request. Request and reply are connected with the ‘id’ attribute (that’s a feature in the json rpc protocol, which Qlik Sense is built on). This means we can filter on the id attribute to find the reply for a specific request. If you try typing in “id”:1, in the filter box you will get request #1 and it’s reply:
So now we know how to find a request and it’s reply, but to really understand what’s happening we also need to understand handles.
Handles is a Qlik Sense specific concept, not part of Json RPC but an addition to it, made by Qlik. The QIX protocol is object-oriented, meaning that all commands are sent to an object. When you connect to Qlik Sense engine, the only handle available is the global handle, -1.
The first thing you do in most cases is call OpenDoc to open your Qlik Sense app (or Doc, as its called in the QIX documentation). If that succeeds you will get a handle (called qHandle) back in the reply. You can them send Doc commands to this handle (almost always handle 1). If you type in the filter “handle”:1, you will see all app commands used:
As you can see there is a lot of them. Most of them fetches or creates objects in the app, with GetObject or CreateSessionObject. You do not see the replies, only the requests, since the replies do not contain the handle. But if we instead filter by the id of one of the GetObject calls, (in my case id 13) we can see what happens:
As you can see in the reply there is a new qHandle in the reply, #5. So now we can filter on “handle”:5, and see what commands were sent to this object. If you want to know what handle is used for your extension, there is as far as I know no way to get that information from standard Qlik, but you can use my Chrome Extension Add Sense.
Find commands that invalidates object
Handles are used not only to refer to objects when you send commands, but also for invalidation. When you change selections (make a new selection, clear selection, apply bookmark etc) QIX engine tells you what objects are no longer invalid. It does this with the ‘change’ array (another addition to JSON rpc) which contains handles for the invalidated objects. So if I for example want to find commands that invalidated opbject 13, I can filter on “change”:\[.*13.*\] (note: a regex, since the handle can be at any position in the array):
We only get the replies for commands that invalidated the object, to get the actual command you need to use the id field to find the actual command and handle.
Version 1.1.0 of my Add Sense Chrome Extension is now available in Chrome web store. This releas has two new features, one of which is pretty experimental.
Properties in patch mode
From the beginning the extension has allowed you to see properties as an object, that includes all properties. But sometimes you need properties in patch format, with the path to each property and the value. This is the format used in one of the most powerful API calls of the QIX Engine, the applyPatches call.
The list of patches you will see:
includes all properties
and can be filtered
Creating the paths for applyPatches calls is one use for it. Another is when you want to for example compare propertries of two objects, like the expressions used (are they the same??) or dimensions. In that case simply open properties for both objects, switch to patch mode and filter on what you are interested in.
Quite frequently you want to copy something from Qlik Sene and paste into a document or another program. This is hard to do. The Enable copy alternative helps you with that by simply turning on standard HTML text select. You can then select and copy text much like in a standard HTML page.
This works well in some cases, but in other it conflicts with the Qlik Sense UI and does not work at all, might even make some stuff unusable. So use it with care and do not have too high expectations.