Sunday, 9 January 2011

Beginners Guide to QlikView Extension Objects : Part 1

I thought that I might write a quick guide to creating an extension objects for QlikView 10.

What is an extension object?  Well, it allows us to create a chart using html and javascript or consume a 3rd party flash/silverlight object.  Our chart can use data from QlikView and it can pass click events back to QlikView.  Basically, we can create any chart that we want that doesn’t exist already.

You might think that there would be a whole lot of work to do to create this, but it is actually really simple to get a chart up and running and consuming QlikView data.

Extension objects live in the C:\Users\your.username\AppData\Local\QlikTech\QlikView\Extensions\Objects folder for desktop users.  Each extension must have a folder for itself.  However, you can have multiple sub-folder levels if you want.

The first thing that I will do in the Objects folder is create a sub-folder for my company’s extensions.  My company is Capricorn Ventis Ltd. so I will create a folder called CVL.  In this folder, I will create a sub-folder for each extension.  First one that I am going to create is HelloWorld (doesn’t every example have to start with a Hello World!).  Now, under the Objects folder, I have CVL\HelloWorld.

Every extension has a minimum of 1 file associated with it - Definition.xml.  This file will define the element, ExtensionObject (which can have other sub elements to, for example, set some default values):

<?xml version="1.0" encoding="utf-8"?>
<ExtensionObject />

That’s it – simple.  We will have a look at some additional options for this file in the next part.

With this one file in the HelloWorld folder, I can now see in QlikView (in Web View mode) when I right-click and select New Sheet Object, Extension Objects, I will see my new CVL/HelloWorld object (with no icon) which I can drag onto the sheet and it will create an object.  It won’t be a very awe inspiring object (a blank box) but you can set properties (such as caption) just as you would for other charts.

We need to add a couple of things to make this just a little more advanced.  First, if we want to have an icon (and you really should), we need to add a 24x24 PNG file called icon.PNG to the folder – any design that you want.  Next, I am going to make a small modification to the Definition.xml file:

<?xml version="1.0" encoding="utf-8"?>
<ExtensionObject  Label="CVL Hello World" />

This label will be what is displayed in the New Sheet Object dialog – next to the icon defined by the PNG file.

Now that those aesthetics are sorted out, we can make the object actually do something.  We need to add a JavaScript file that will define the code that will be run by this object.  The file is always called script.js.  This js file must define a call to Qva.AddExtension which defines a name and function that will be called when the extension loads:

Qva.AddExtension('CVL/HelloWorld', function() {
   // Set the HTML
   this.Element.innerHTML = "<h1>Hello World</h1>";
},true);

Note that the name defined in AddExtension is the same as the path to the folder as it would be from the Objects folder.  This is required.

This code is very simple – it just outputs some simple html – but it reveals how we can do some much more advanced stuff.  If we can generate html, we can output it to our application and do so much!  All we need now is some data.

In the next part, I will show you how to consume QlikView data.

Friday, 7 January 2011

Things I like about QlikView 10 - Part 3: Extension Objects

This is possibly the coolest thing in QlikView.

We were working with a client a while ago who had a very specific requirement for a visualisation. We worked several options with different show/hide options around bar charts and pivot tables but, while they were close to what was required (close enough anyway), they didn't quite hit the mark.

Now I know that i can build exactly what they want with an extension object. I know that I can do this because I know HTML and JavaScript - I know what I can do with it. I don't even need to go to flash/silverlight, I can work wonders in notepad.

Have you had a go yet?

Things I like about QlikView 10 - Part 2: UI

I am quite liking the new container object. My only problem is that I keep forgetting about it and creating loads of separate charts with minimized icons - then it's "Doh!" It is cool though.

Linked objects are starting to save a whole load of time - especially those date list boxes that I will have on most every sheet in a document. Being able to link and then change once is a great boon.

Many of our customers now use Ajax as their primary client. Therefore the WebView option in QlikView desktop is really cool. Being able to wysiwyg in Ajax is great.

Things I like about QlikView 10 - Part 1: Script

One of my favourite things about v10 is the changes that they have made to the load algorythm to multi-thread the symbol table creation. While you won't notice it so much up to a couple of hundred thousand rows of data, when you get into the millions it makes such a difference.

I am also a big fan of the new QVConnect process that allows you to use a 32bit driver on a 64bit server. It isn't something that we have run into everywhere but we have had a few customers with Accounting systems that only provided 32bit ODBC drivers. Now, it isn't even a consideration. Yay!

Within the script editor itself, the script syntax checking is taking some getting used to but is starting to save me a whole load of time. I am really enjoying the auto-complete here too.

Friday, 19 November 2010

Do we really need maps for analysis?

This is a response to Barry's QlikFix post - http://t.co/q4jPQAs

While interesting that 80% of data may have a spatial component (depending on how you define it), the reality is that the majority of that data does not have a special dependency – it is not really that suitable for display on a map.

A common example for such displays might be something like sales by state. These are often displayed as bubbles geographically positioned over the state in question but do they really help with the analysis? Sure, you may be able to easily see that sales in California are larger than in Oregan, but how do they compare against sales in New York, New Jersey and Rhode Island that may be smudged together on the far side of the map. What might look “cool” on a demo may turn out to be something that is easier to analyse in a bar chart.

One other unfortunate flaw is the level of education that might be encountered. Studies have shown that percentages of schoolchildren in the UK have difficulty picking out their own country versus France or Germany! Can we expect that everyone who needs to analyse European data is actually aware that the boot shaped country is Italy?

Maps can be cool and have some great applications (many of which can be easily done in just Google maps without QlikView). Real world analysis can mostly do without them.

Sunday, 14 November 2010

It is often simpler than it looks

Often, as we encounter more and more diverse data, we encounter data structures that would appear to call for more and more complex workings to associate them in QlikView. What we need to do though is take a step back and see if there is a different way. My experience is that once I do this, I find that it is often simpler than it looked.

For example, you have 2 or 3 tables that have several fields in common. Some might start down the route of generating complex keys (for example, with autonumber or autonumberhash256) and one or more key tables. A second look might reveal that if we simply concatenate all the tables - even though it appears that they are unlikely candidates for concatenation - then we will suddenly be left with a simple key table and some dimension tables.

Another way of simplifying things that I use all the time is ApplyMap. This is a really useful function (not unlike vlookup in excel) that enables us to map small tables into larger tables. Always look to see if you can do a mapping load.

It is often simpler than it looks.

Thursday, 30 September 2010

Access DBs on 64bit

I have written before about the issues of 32bit drivers on 64bit QlikView. It is great to see that version 10 will get past this but, if you need to get Access data into your server now, on earlier versions, that is not a help.

I am writing this because it is fresh in my mind because I have had the exact problem with a client. They had an old Access database that they needed to get data into on 64bit QlikView. Now, I have a 64bit Access driver because I have 64bit Office 2010 and it works great in QlikView. Microsoft have released this as a separate download so you don't need office installed on your server:


You don't need newer format Access databases, it works with older mdb files too. Only criticism that I have is that the DataLinks properties box doesn't have an ellipse button to allow you browse for your database. This isn't the most difficult thing to get past, just paste the path into the properties box.

Hope this helps.