Include files in qlikview

Qlikview include files provide similar functionality that other programming languages such as PHP’s include files do. Imagine that you have to create a customer sort order list, or to custom format certain fields that are being used in multiple documents. You can make Qlikview designer’s life easier by creating a customer order list or by creating a list of fields with custom format and by storing them in an include file.

If you have a QVW template then you can add include file in the template. But, let’s step back and understand how Qlikview stores data. That knowledge will be essential not only to simplify scripting but also to create ease of maintenance for multiple documents.

lightbulbQlikview stores your document into two levels: First level contains a distinct list of values, and second level stores data containing of pointers.

 

Each field in your document contains one list. So, if you have 100 fields then you will have 100 lists. Qlikview remembers each field value and its format as value gets loaded during the reload process.

lightbulbRemember: No matter how many times a data field value is loaded, or how many tables contain that firled value, it is stored only once in Qlikview.

 

 

How to Create a Customer Sort Order using an Include File

Since now we know how Qlikview stores data, let’s leverage that knowledge to create an include file containing custom order Sales Rep name order list. We will also use the same include file to create custom formats for some fields such as Order Date and Sales Amount.

Steps:

1.  Let’s first create a data set for this tutorial. It has three columns:  Order Date, Last Name of the Sales Rep and Sales Amount.

 

Qlikview include files

 

 

As you can see, each field contains values that are repeated many times in the table.

2.  Create an Include file for the custom sort order and custom data formats.

custom sort order in qlikview

 

3. Include this text file into your Qlikview template or the document, and reload your document. Since Qlikview remembers each value in its order as it gets loaded into memory, it will show Sales Rep list in the order dictated by your inline table. Since it also remembers the data format when the field first gets loaded, we now can create a single row table containing list of fields with custom data format.

format data with qlikview include file

 

Elsewhere:

Storing Variables Outside of Qlikview via Qlikfix

photo by: Velo Steve