QlikView Extension Tutorial #2: Hello World – Creating Your First QlikView Object Extension

This article is part of a series of articles, see also the table of contents.
Previous Chapter

OK, it’s now time to stop with theory and start coding. We’ll create our first “Hello World” extension.
The easiest way to start with your first QlikView Extension is to create the required extension code where QlikView expects extensions to be:

In Windows 7/8 QlikView is loading extensions from the following folder:

C:\Users\%USER%\AppData\Local\QlikTech\QlikView\Extensions\Objects

Step 1 – Creating the Necessary Files

  1. First create a folder named “ET-HelloWorld” (ET stands for Extension Tutorial).
    C:\Users\%USER%\AppData\Local\QlikTech\QlikView\Extensions\Objects\ET-HelloWorld
  2. Create two empty files within this folder, one called “Definition.xml” the other “Script.js”

The Definition.xml file is the main file where QlikView searches for some meta-information of your QlikView extension. We start with a basic set of information:


<?xml version="1.0" encoding="utf-8" ?>
<ExtensionObject  Path="ET-HelloWorld" 
                  Label="Hello World" 
                  Description="Hello World Extension" 
                  Type="object">

</ExtensionObject>

If QlikView loads this file the following information is set:

  • The path (folder) of our extension is set to “ET-HelloWorld”.
  • Label and Description is set to “Hello World” and “Hello World Extension”, we will recognize these values in a few minutes when we are adding the extension to a QlikView Document.
  • Finally we have defined that we are aiming to create an Object Extension by setting the “Type” attribute to “object”.

Now open the Script.js file and type/paste the following code into it:

Qv.AddExtension("ET-HelloWorld",
        function () {

            // Set the extension object's inner Html
            this.Element.innerHTML = 'Hello World';

        });

If this piece of code is loaded by QlikView an extension will be made available in QlikView Desktop and the inner Html of the extension element will be filled with “Hello World”.

Note: For ensuring that we do not have a conflict with other QlikView Extensions I will – in all chapters – use the prefix “ET-“ in all examples we create together.

Test Your Hello World Extension

Now let’s add the newly created extension to a new QlikView Document:

  1. Open QlikView Desktop
  2. Create a new QlikView document and save it
  3. Switch to WebView
  4. Click somewhere in the sheet and activate the context-menu (right mouse click)
  5. Navigate to “New Sheet Object”
  6. Switch to the accordion panel “Extension Objects”
  7. You should now see a window very similar as the one below with at least having your “Hello World” extension in the list of available objects:

Hello World Extension in your list of extensions

  1. Drag & Drop the “Hello World” extension somewhere to your sheet.
  2. You will see the result of your “Hello World” extension:

The resulting Hello World extension

Congratulations, you have created your first QlikView Object Extension!

The Anatomy of a QlikView Extension

It’s now time to understand the anatomy of a QlikView extension. There are at least, as you have realized in your Hello-World example, two files required for an extension to work property:

  • Definition.xml
  • Script.js

But there are other files too, so here’s the list of all possible elements of an extension:

File Name Description
Definition.xml Within the Definition.xml file some meta-data (like the name of the extension, a description, etc.) and all properties and initial values for the extension are defined.
Script.js The Script.js file is the main entry point for your extension, QlikView is loading the extension only if a Script.js can be found and is a function called Qv.AddExtension within this file.
Icon.png By adding a file called Icon.png to the directory you can define the icon shown in the list of all extensions.
This should be a PNG-file with 24×24 pixels.
.qvpp files QlikView Property Pages, you’ll learn more how to use this functionality in some of the following chapters.
Additional files Additional resource files like JavaScript files, images, etc. – you’ll learn more how to reference these files in one of the following chapters.

In the next chapter we’ll concentrate on improving the experience of our Hello-World example.

Bookmark and Share

and tagged , , , . Bookmark the permalink. Both comments and trackbacks are currently closed.

5 Comments

  1. marino bozic
    Posted December 10, 2013 at 10:12 | Permalink

    Your work is fantastic and I learned a lot from this
    continues this way.
    thanks

  2. Vartika
    Posted December 11, 2013 at 13:05 | Permalink

    Hi Stefan! You have an amazing blog I discovered today. The extensions blogs are easy to learn and very helpful!!

    Thanks a lot for developing all this content.

  3. christophe
    Posted February 18, 2014 at 13:19 | Permalink

    Hi,

    Thanks for this blog serie, I wait for more stuff on extensions !

  4. Sunny
    Posted April 18, 2014 at 18:34 | Permalink

    @Stefan do we need to write this code in notepad file or qlikview files?

  5. nagaraju
    Posted July 7, 2014 at 07:46 | Permalink

    Hi All,

    I need some help..
    i am also using same kind of extension (HTML Extension)

    I have created 4 tabs in Extension..
    if i am click any button i want to go other sheet in qlikview..
    is it possible…???

    if i am click button1 ====> Sheet1
    button2 ===> Sheet2

    same like 3 and 4 button also..

    Hope you undersatnd..

    Thanks in Advance……