Building a nicer (dynamic) multibox, without extensions

By Barry Harmsen

Building a nicer, dynamic multibox in QlikViewThe multibox is a QlikView object that I find extremely useful because it allows you to fit selection fields into a much smaller space. At the same time, I also find it extremely annoying; the gradient looks dated and if you want your field names and values to be readable you will often have to make both columns quite wide. For these reasons I tend to not use the multibox in my applications, using a conditionally hidden drop-down filter panel instead.

Recently, I was hired to perform a health check on an application. The application made extensive use of a multibox (in a very nice and flexible way, I should add). One of the challenges my client was facing was that not every field was relevant to every user. Besides a general technical review of the application, the developers wanted to know if it was possible to create a dynamic multibox. A multibox where users could select which fields they want to show.

As I started digging in to this question, I realized there’s a much nicer way to create a multibox. After experimenting with it for a bit, I actually like this solution so much that I will probably be using it in some of my future projects.

A nicer QlikView multiboxA nicer, cleaner multibox

On the right you can see the solution that I came up with. It’s based on a pivot table object and here’s how it’s done:

  • All user-selectable fields are placed in the Dimensions tab, with Enable conditional set up for each field. This allows for the visibility of the field to be toggled.
  • The Label for each dimension is set to an expression that shows the name of the field (or a developer-defined label) and the current selections on that field (using the GetFieldSelections function).
  • On the Expressions tab, we can enter any (temporary) expression. I used a dummy-expression of =1.
  • On the Presentation tab, Dropdown Select is enabled for each dimension and Always Fully Expanded is enabled. Optionally, Wrap Header Text can be set to 2 rows, which I find gives a nicer look.
  • Next, the object properties are closed and all dimensions are dragged into a vertical row.

The intermediate result should now look like the following image:


As you can see, the pivot table is showing the data area right next to the headers. The magic trick to remove this data area is to open the properties window again, navigate to the Expressions tab and replace the Definition with a single zero (“0”). Ensure that Suppress Zero-Values is checked on the Presentation tab. After closing the object properties, we are left with just the headers, which have a drop-down select on each of them; a much slicker multibox.

Why it’s nicer

Besides looking better, this multibox has a few other advantages over the original:

  • The multibox is dynamic, you can let the user dynamically select which fields to display, or even use Section Access to predefine which fields are shown in the multibox. Of course, you do not need to use this option and can also create a static multibox that just looks a bit nicer.
  • The user can dynamically reorder the fields by dragging and dropping them.
  • The drop-down list of values is shown over the full width of the object.
  • Unlike the standard multibox, this version does not only display the selected value when a single value has been selected. It will show a list of multiple, selected values (of configurable length) or will display the number of selected values, as shown in the image below:

A nicer QlikView multibox, with selections

But wait, there’s more

As pivot tables allow for both horizontal and vertical placement of columns, we can use the same solution to create a nice, horizontal drop-down selection menu.

Horizontal drop-down selection bar

A very slick way to display multiple selections in a relatively unobtrusive way!

What’s the catch?

There are two things to keep in mind when using this solution:

  • Due to a bug, you will not be able to use the drop-down select on the bottom field in the multibox when using the AJAX client (this doesn’t affect the horizontal version). A workaround is to add an additional, blank dummy dimension.
  • And, the main catch, as we’re using a pivot table, this solution will not perform well when using larger data volumes. As the data volume becomes larger, the object will require more calculation time and consume more memory. I’ve tested this solution with various data volumes and found that it was workable when data volumes were in the hundreds of thousands, but millions of rows lead to unacceptable response times. Of course, this also depends on the number of fields that you place in the multibox, more fields will mean slower calculation.

Carefully consider these caveats before deciding to implement this solution.

OK, got it, now let me try it

I’ve created a small example application so you can try out this solution for yourself. The application can be downloaded using the link below:

Download the dynamic multibox application

Of course, I look forward to hearing your feedback or potential improvements. Especially if you’ve solved this same problem in a different way. Feel free to add a comment below.

Update 2014/07/09: I’ve replace the single space expression with a zero, many thanks to Hennie Welman for pointing out this improvement.


Masters Summit for QlikView - Amsterdam

Masters Summit Amsterdam – October 1-3, 2014

If you haven’t heard already, our traveling band of QlikView enthusiasts will be touching down in Amsterdam October 1st-3rd. I will be delivering sessions on data modeling and server administration. Hope to see you there!

More information can be found at the Masters Summit for QlikView website.