As a QlikView developer I am often asked to load images into QlikView. In some instances the images are associated to other data fields and in other instances they are to be loaded in to the application to help convey a message. For example, let’s say that you need to bring in flags of countries that are to display when the corresponding country is selected and you need to display an icon that indicates whether sales for a country are above or below a predefined threshold. It sounds like an easy enough task; so how do you do it?
Well, QlikView offers the developer the Bundle function that can be added to the Load statement. Bundle Load statement allows the developer to load the image files directly into the QlikView application for portability.
The Bundle Process is a very simple scripting process. The syntax for the Bundle Load should look like this:
The image file should contain two fields:
- The first field is an identifier such as an index number, image name, a key field that associates the image back to other data files, etc.
- The second field should contain the path to the image.
This file contains the CountryID so that I can associate the flags with the countries
This file contains just an image name because I am just using these icons as a reference and they are not associated to any fields in other files.
Once the images are loaded into QlikView we can now reference them using the INFO() function and a standard IF Statement:
I am using the INFO() function to display the flags so whenever a Country is Selected, QlikView will know to go grab the corresponding image based on the CountryID. If we needed to, we could do the same thing with the symbols by simply adding a list box for Image Name and selecting an image from there. For this example though, I am using a standard IF Statement to display the symbol for the country sales.
Here is what it looks like when the user selects a country. The Info() function displays the image associated with CountryID =1 and because Sales were above the threshold the green square is displayed.
One note of caution, when images are loaded into a QlikView application using the Bundle Load statement, both the amount of RAM and the size of the application increase so consider both the size and the amount of image files before deciding to use the Bundle LOAD statement.
I wrote a technical brief that outlines these steps in more detail. You can access it here.