No matter what type of Qlikview application I work on, List Boxes are always prevalent. In some cases, there are dozens of List Boxes on a single sheet.
It didn’t take long to realize Qlikview does not allow you to format multiple list boxes at once, for many property settings such as “Show Frequency” or setting up the List Box as Multicolumn. The only tabs in the properties window available for multiple objects are Font, Layout and Caption.
After searching around forums and working with the Qlikview APIGuide, I came up with a fairly simple solution to accomplish this task.
Here are the steps to accomplish this task:
Create a Qlikview App and setup a few List Boxes. Don’t change any of the properties, but you can move them around for viewing purposes. Then create a new macro and insert the following code:
set sheet = ActiveDocument.Sheets("Sheet5")
lbs = sheet.GetListBoxes
for i = lbound(lbs) to ubound(lbs)
Set obj = lbs(i)
set objbox = obj.GetProperties
objbox.Layout.ShowFrequency = true
objbox.Layout.Multicolumn = true
set objframe = obj.GetFrameDef
objframe.SearchIcon = false
In order to run the Macro, setup a button object and assign the macro as the Action for the button:
Now you’re ready to test it out. Here is how my List Boxes look before the formatting macro is run:
Here is how they look after running the macro:
And there you have it, a quick and easy way to format property values for multiple List Boxes at the same time. Keep in mind that each property setup in the macro above will be applied to ALL List Boxes on the given Sheet. Make sure any formatting you apply using this technique is applicable to all the List Boxes.
Note: The “Show Frequency” option is not available for Key fields, so this is why it does not appear in the List Box for “NFLYear”.
If you are looking for a good reference guide on working with Qlikview objects in VBScript (macros), you can download a full version of the Qlik API Guide at the following link:
This is a zip file which can be downloaded to your local PC. You can then browse through the files to understand how to work with different types of objects and settings. This is a good document since it does not require an actual license to view.
By using this technique, I am now able to format multiple List Box properties at one time. This has saved me time in many projects, eliminating the need to open each List Box individually and setting property values.