Wednesday, 9 May 2012

Becoming a QlikView addict

My introduction to QlikView isn't that different to many others. I started out as a customer back in 2005, QlikTech had just opened their UK office and there wasn't many people around who you could describe as an expert in QV. Because of this we made a ton of mistakes along the way and banged out heads of a fair few walls too. But for me the most interesting part of  getting to grips with QV came before we'd even brought the software.

My role at the time made me the interface between the outsourced IT partner and the business, running around trying to tie everything together to ensure projects got delivered and if possible on time and budget. One day a senior manager dropped me an email with a link to the QlikView website and a note asking me to let him know what I thought. He'd been told about QlikView and wanted to know if it could do what the "marketing gumf" said it could. After a quick read through the material I replied to the email with a large dose of scepticism but was told they were coming in to give us a demo.

Back then, BI tools were all what I'd now refer to as "Traditional BI". Complex, cube based tools that required a life time and a small army to implement successfully. I'd worked on a couple of BI projects and didn't have a very high opinion of their value for money. The day of the demo dawned and I'd been having a terrible week. Several projects had hit problems, I was getting pressure from all sides and I could have done without losing an hour to someone trying to sell me a tool I was convinced we didn't need. In the end I resolved myself to the fact that at least I'd be able to ask a few technical questions and enjoy watching them squirm trying to answer.

What happened instead wasn't so much a demo as an hour of consulting and it truly blew me away. This pre-sales consultant sitting before us had managed in an hour to show us how to load a relatively large volume of data from our own systems into QlikView and built some rudimentary charts on top. Admittedly the end result wasn't pretty or efficient but it worked and if that could be done in an hour, pretty and efficient couldn't take long either. I was hooked on the spot and went away with a trial license in my pocket (long before the days of personal edition) and an intent on having a go myself. The rest as they say is history and needless to say it didn't take us long to decide to buy.

What made me decide to write this post was a discussion I was having with a customer last week who had recently purchased QlikView. We were discussing his introduction to the tool and how his experience was different from my own. There are now a plethora of traditional BI, data analysis and visualisation tools available with each claiming to be better than the rest. Customers have seen and done it all before and so achieving that same awe factor is much much harder.

Over the last few days since, I've continued to play over this idea in my mind. The conclusion I've come to is that whilst some aspects of introducing a person to QlikView may be different today, there are a lot of similarities too. And most importantly of all I am convinced that the similarities are the most critical aspects of the process. Much like I thought, most potential customers believe they have seen and heard it all before; that fundamentally all BI tools are the same. They don't want to be sold to, are too busy to listen to yet another pre-rehearsed sales pitch, and have other problems they'd rather be concentrating on.

What any QlikView salesperson needs to do most of all is to NOT sell QlikView. No, I've not gone mad (I've been that way for quite a while), what they need to do is to help the customer. Don't waste their precious time, help them to understand how QlikView can instead save them time and a massive headache. Make it relevant to them; anyone can demo a pre-made application that they know inside and out. If possible, build something with their own data, or at the very least have a demo application that is relevant to what they do and don't just demo it, develop it. They don't want to believe you, why the hell should they, they want to see for themselves.

QlikView must stand apart from the mass of BI tools available. Forbes last week placed QlikTech at number 3 in their Fast Tech 25 List of the fastest and strongest growing companies in the US. They come behind only Apple and LinkedIn and ahead of many great technology companies. They are also the only BI software vendor listed. Help the customer to see this for himself, and I don't mean send him the think to the Forbes website, I mean SHOW him how QlikView is different. Again, don't just tell him and expect him to accept you know what you are talking about, he doesn't know you anymore than the other sales people who cross his path on a daily basis.

Looking back, that's basically what the pre-sale consultant did for me. He helped me to see how QlikView was different, how it could be implemented so quickly, efficiently and not just be another expensive, painful IT project for our business. That was why I was blown away in 2005, and that's not changed an iota between then and now.

Thursday, 3 May 2012

QlikView for Notepad++ Update

NOTE: Links in this post are to deprecated versions, please see the QlikView Notepad++ page for the latest version and instructions.

Since so many people seem to have downloaded the QlikView language definition for Notepad++ that I released earlier this week, I thought I'd better finish adding the keywords and statements that were missing. It should now support ALL keywords and statements as well as all functions and line and block comments.

For those who haven't yet tried it you can read the instructions from the original post http://www.qlikviewaddict.com/2012/04/qlikview-scripts-in-notepad.html

For those that already have the first release you will need download the new language definition file http://qvacb.googlecode.com/files/qlikview-lang-def-v0.2.xml

You'll need to follow pretty much the same steps as before but remove the old QlikView language definition file before importing the new one. You can do this by selecting "QlikView" in the User language drop down at the top of the User Defined Language dialog and then click "Remove". You can then import the new file.

As before if you find any issues leave me a comment below.

QlikView Power Tools v1.1 Released

An updated set of QlikView Power Tools has been released including a couple of new tools:
  • QlikView Server Super Agent - A monitoring tool for QlikView Server, that monitors Qv services regardless of version (9+) and reports any service outage with email notifications and/or log files
  • Qv Server Object Connector - A custom data connector for QlikView that much like the SharedFileViewer provides insight into .shared files, but instead allows to load data straight from .shared files into QlikView documents for analysis. The tool supports extraction of data like ownership, size and type of objects, expressions, annotations, bookmark selections (fields and values) and much more.
And updated versions of the following tools:
  • QlikView Server Agent
  • Qv User Manager
  • Server Object Handler
  • Shared File Viewer
You can read more details and download the Power Tools from http://community.qlikview.com/message/215866#215866

Monday, 30 April 2012

QlikView Scripts in Notepad++

NOTE: Links in this post are to deprecated versions, please see the QlikView Notepad++ page for the latest version and instructions.

I've been working on a project for the last few weeks which has required me to use a lot of separate QlikView script files. For those that don't know, it is possible to include text files containing QlikView statements into the script of a QVW using the following statement:

$(Include=abc.qvs);

The lines in the separate file will be included in the QVW script at the point of the include statement and run as if they were in the QVW script. Note that the file extension is not important but .qvs is the extension QlikView uses when you ask it to export the script from a QVW so I generally stick to using the same. Using separate script files can be a really powerful tool when trying to perform the same data loading and manipulation tasks in multiple apps. Changes can be made to the script file once rather than having to make the same change repeatedly in the multiple applications where its used.

Anyway, on to the real point of this post. I like to use Notepad++ as my text editor when working with XML, HTML, etc and so naturally that's where I went to create my QlikView script files. But I quickly became annoyed that the nice QlikView syntax highlighting that I'm used to when working in QlikView Desktop was missing, making reading and editing the script much harder. So with a spare half an hour I created a Notepad++ custom language definition for QlikView and thought I'd share it so others can benefit too. Its by no means perfect and won't give you an exact representation of the script as you would get in QlikView's Edit Script dialog but it will highlight comments, functions and most keywords. It supports the following:
  • All current QlikView functions
  • Most commonly used keywords
  • Line comments (//) and block comments (/* */)
If you find any keywords missing then leave a comment below and I'll add them and re-release. I've also included support for a little something I've been working on and am hoping to release soon. Watch this space!

Installation

Here are the steps to getting it installed and working yourself:
  1. If you don't already have it, you can download Notepad++ from http://notepad-plus-plus.org/download/. Its completely free and a great text editor. If you are running an older version I'd recommend you upgrade to the latest as some older versions can't import language definition files and so you'll get stuck with the next steps.
  2. Download the QlikView language definition XML file from http://qvacb.googlecode.com/files/qlikview-lang-def-v0.3.xml.
  3. Open Notepad++ and navigate the menu to View-> User-Defined Dialog...
  4. Either a floating window or a panel to the right will appear, click on the "Import..." button within it.
  5. Navigate to the location where you saved the XML file to and select it and click "OK".
  6. Hide the language panel by again selecting View-> User-Defined Dialog... on the menu.
If you open a .qvs file, Notepad++ will automatically identify it as a QlikView script file and apply the language definition for you. If you are creating a new file or using a different file extension then you'll need to change the language using the menu  Language -> QlikView.

And that's it! Happy QlikView scripting.

Thursday, 19 April 2012

It wasn't me officer!

I received a message this week asking if I might be the infamous "QlikView addict" from the well known video released back in 2006. Alas, I can't take credit for this but I thought I'd post it for those who have never seen it. If you can't remember the days of QV 7 & 8 you might not get all the jokes but it's still amusing to watch.


Thursday, 12 April 2012

QlikView 11 SR1 Re-released

QlikTech have re-released QlikView 11 Service Release 1 today after withdrawing it because of a significant bug. It's available from the download site as usual.

Wednesday, 4 April 2012

Handling Nulls in QlikView

The way in which QlikView's associative engine works means Nulls don't really exist in the data it holds, a Null is simply an absence of a data item. This can make working with Nulls a little tricky until you understand the tricks and tips which can make it a little simpler. For example, what if I want to display customers with missing phone numbers, I can't simply make a selection for Null in the phone number list box as it doesn't exist as a data item.

Here are a few tips and tricks which can make working with Nulls in QlikView a little simpler.

The Null() and IsNull() Functions

It is possible to generate a Null value in the script or an expression using the null() function. For example, you might want to replace zero's with a Null so that they don't take up valuable resources when dealing with very large data sets or don't effect an average calculation. This is pretty simple using the null() function like this:

if(SalesValue=0, null(), SalesValue) AS SalesValue

With this in mind you might think you could also use the null() function to test if a field contains Null like this:

if(SalesValue=null(), 'NULL', SalesValue) AS SalesVale

Great, I can now select the Nulls right? Wrong! It is not possible to compare against the null() function as shown above and interesting doing so will not result in a script error either. Instead a separate isnull() function exists for this purpose and can be used like this:

if(isnull(SalesValue), 'NULL', SalesValue) AS SalesValue

The NullAsValue Statement

The above example of replacing Nulls is often the first solution people reach for when building a QV app. However there is an alternative which can not only be cleaner but also a more efficient solution. The NullAsValue statement does as you might expect it to, replacing Nulls in the given list of fields with a value which can be seen and selected in a list box. The syntax is very simple as follows:

NullAsValue Field1, Field2;

As you can see, it is possible to list more than one field and it will also except wildcards in a similar way to the Qualify statement as described in a previous post here. By default, NullAsValue replaces the Null with a zero length string but this can be changed by setting the NullValue variable as follows:

SET NullValue = '<Null>';
NullAsValue SalesValue;
NullAsNull *;


There is one thing to be careful of when using NullAsValue though. Optimised QVD loads do not reprocess the data within the QVD row by row and thus it will not apply the NullValue to the data. To get around this you must force an unoptimised load of the QVD. This can be done by adding a WHERE clause to the load that will always apply like this:

LOAD
    *
FROM myqvdfile.qvd (qvd)
WHERE 1=1;

Nulls in Basic Maths

Another issue with Nulls occurs when you want try to perform simple maths with them. For example, you might expect that 5 plus Null is 5 when the real answer is in fact Null. This can be a very real problem when adding 2 fields together and one or both have records containing Nulls. As always there are multiple solutions.

One method is to use the alt() function which accepts a list of values and returns the first which is a true numerical value. We can thus use it as follows to solve the problem of performing maths around Nulls:

alt(SalesValue,0) + alt(SalesMargin,0) AS GrossSalesValue

If either SalesValue or SalesMargin contain a Null value, it is instead treated as zero and the calculation will give the result we might have expected instead.

An alternative is to use the range functions such as rangesum(), rangecount() and rangeavg(). These functions are passed one or more values and return the sum, count or average respectively of only those passed values that are truly numerical. Nulls are not considered numerical values and thus are ignored and so we can can use rangesum() to solve the same addition problem as follows:

rangesum(SalesValue, SalesMargin) AS GrossSalesValue

Counting Nulls

It can often be necessary to count Nulls. For example I might want to know find out how many customers I have no address for. Counting Nulls in QlikView is made easy using the nullcount() function which pretty much does exactly as you'd expect. It can be used in both the script and expressions and the syntax is very straightforward:

=nullcount(Address)

Selecting Nulls (including in set analysis)

You obviously can't directly select Null in a list box as it won't appear although you could use one of the methods describe above, such as NullAsValue, to convert the Nulls into a value that can be selected. You might think searching for "=null()" might work bit it won't. However it is possible to indirectly select Nulls within list boxes or even set analysis expressions in QlikView using an advanced search. You can't search within the same field as it won't possible to select the Nulls when you apply the search but you can search in one field for those values that relate to where another field is Null.

Using the example we considered above of finding my customers for whom I have no address, we can't search for null() in the Address field but we can search the Customer field for isnull(Address) like this:


Advanced searches can be used in set analysis expressions as well as list boxes and so we could use the following expression in a chart or text object too:

count({$<Customer={"=isnull(Address)"}>} Customer)

I'll leave you with one last thing to keep in mind with Nulls and set analysis. One thing that sometimes people don't fully understand is that there is a big difference between selecting all values in a field and selecting no value. The difference occurs because of Nulls. Selecting all values in a field excludes records for which that field contains a Null value. You can do just this in set analysis like this:

count({$<Address={"*"}>} Customer)

And a quick word of warning. You may see the following syntax to exclude Nulls written sometimes on blogs and forums:

count({$<Address-={"null()"}>} Customer)

If you try it you'll find it may well work, but it is considered bad syntax and QlikTech may correct it in the future and so it is best avoided to ensure your application is future proof.