Often times, a key requirement in the development process of a QlikView dashboard is incorporating images within the user interface. Developers can use the BUNDLE function to make it easier to load and reference images with charts and text objects.
Here’s a typical scenario most developers run into:
“In the development of a global dashboard consisting of ~ 150 countries and, as part of your requirements, when a user selects a country, the country’s national flag will display (associating an image to field values). Additionally, users will see certain green/red arrows to appear based upon the +/- sales growth (referencing an image based upon expression results).”
Using BUNDLE in QlikView, you can accomplish both these objectives.
Scenario 1: Connecting/Associating Images to Data Fields Values:
In this scenario, we are essentially tagging a field in the QlikView data model with an attribute that is represented by an image or sound file. This method instructs QlikView as to what image to display based upon a user’s selections.
Similar to a mapping table, two fields are loaded into the data model:
1.) An ID or KEY field linking the image to the dimension in the data model
2.) The file path where the image resides, identified by the KEY field
Here is an example based on the requirement above to associate a country with its flag:
The images are saved in another folder which QlikView will read into the data based upon the specific file path. In the below example, an absolute path is being used but in order to remain portable, you can also use a relative folder path.
After the script reloads, the images are available within the Edit Expression dialog box, under the Images tab. We can now reference the image we want to see by using the INFO function and the KEY field.
Scenario 2: Loading Images Unassociated to Data Field Values:
In this scenario, the image may be referenced from the interface using a specific syntax:
qmem://< fieldname> / <fieldvalue>
Similar to the first scenario, you first load in the reference file that contains the image name and the location of the image.
Upon reloading, the images are accessible within the QlikView application. These images can be referenced in expressions by changing the representation of the expression to Image. Remember, we want the image to display based upon meeting certain criteria of an expression result (think Visual Cues, but with images).
Next , use the syntax stated above within the expression syntax. Based upon the results of the expression, an image will display (e.g. +Sales Growth% and a green up arrow; -Sales Growth % and a red down arrow). When the images are loaded into QlikView, they become accessible through the Images tab on the bottom right of the Edit Expression dialogue box, just like in Scenario 1.
The result is shown below. Note in our above expression, the green square will display if Sales are greater than $3M, otherwise it will be a red circle. Sweden has sales less than $3M so the red circle is displayed whereas the United States has sales of $5M so the green square is displayed.