2 min læsning

QlikView - Loading images into memory

Featured Image

Images in a QlikView application can be power full in many ways. Most of the time I see solutions where images are used as background in text objects, but it’s also possible to load images into memory and connect the images to your data – and then it starts to get funny!

When loading images into memory and connect them to for example an employee dimension table, you are able to show an image side by side with the data of the employee. Even images use a lot of screen space, it gives sense in many occasions because images are faster to read and understand for the brain than text.

However, there are some considerations to think about, before you load tons of nice-looking jpg-files of all your employees into your application.

First, be care full about the size of each image. The bigger size, the longer it takes to show the image. Keep each image to a thumbnail-size (100 kb or less). I have seen solutions, where more than 60.000 images of that size are loaded into memory and it had very small impact on the performance. However, 60.000 images of 100 kb each consume 6 GB RAM, so you must ensure that you have enough RAM-storage.

Use the same background for each image. If you would like to upload images of employees, then try to avoid images where some pictures have a light background and others a dark.

If possible, use images in the same resolution.

Also, consider what happens if an image of an employee is not available. In most cases, I prefer a dummy picture is shown instead.

No-Photo-Available

I have seen problems doing binary loads with images, so I recommend that you load your images in the final application tier and not in the QlikMart tier – if you have a QlikMart tier.

The easiest way to load images into your application is to ensure, that your files are named with the business key. So If your business key in your employee table is Initials, then make sure, that your files also are named with the Initials.

Then created a new attribute field in your Employee table containing the file path to the image.

Your Employee table (Dim_Employee) could look like this (field names):
Employee_Key
Employee_Name
Employee_Initals
Employee_ImageFilePath

Where the field Employee_ImageFilePath contains the path to the image, for example:
\servernameE:QlikViewFrameworkImagesHEMA.jpg

Now all you need to do is loading the images into memory. To do that, you need the following simple script:

Info:
BUNDLE INFO LOAD
Employee_Key,
Employee_ ImageFilePath as info
RESIDENT Dim_Employee;

To test the image in the application you can use the following expression in a text box:
=info(Employee_Key)

And you have a nice looking image:
HMA

Good luck!

Any questions?
Feel free to contact us if you have any questions: info@inspari.dk / + 45 70 24 56 55.