This article demonstrates a custom solution how to pre-select a category in QlikView AccessPoint. The pre-selected category will be opened by default, but the user still has the possibility to change the category by using the category select box (which is the default behavior of QlikView AccessPoint).
Setup
Follow these steps to customize your QlikView AccessPoint:
- Make a backup of the index.htm (which can be found at C:\Program Files\QlikView\Web)
- Add the below posted code to the header of the index.htm (after the jQuery include) and before the end of the html head tag
- Save the index.htm
<!-- Begin of customization for pre selecting categories in AccessPoint --> <script type="text/javascript"> $(function () { var cSelectedCategory = 'SelectedCategory'; function preSelectCategory() { var selectedCategory = unescape(getQueryString(cSelectedCategory)); if (selectedCategory) { selectedCategory = (selectedCategory == 'All') ? '' : selectedCategory; //console.log("PreSelect Category based on QueryString: " + selectedCategory) $('#Category').val(selectedCategory).trigger('change'); } } // copied from: http://stackoverflow.com/questions/3788125/jquery-querystring function getQueryString(key) { var re = new RegExp('(?:\\?|&)' + key + '=(.*?)(?=&|$)', 'gi'); var r = [], m; while ((m = re.exec(document.location.search)) != null) r.push(m[1]); return r; } // Calls setTimeout(preSelectCategory, 100); //console.log(ap); }); </script> <!-- End of customization for pre selecting categories in AccessPoint -->
Usage
Now you can passed the category which should be pre-selected via the QueryString:
Example for pre-selecting the category “Sales”:
http://localhost/qlikview/index.htm?SelectedCategory=Sales
Another example for pre-selecting the category “Sales Applications”:
http://localhost/qlikview/index.htm?Sales%20Applications
Note: %20
is the encoded character for a white space
Compatibility
I have tested this solution for the following browsers:
- Chrome 27
- Firefox 21
- Internet Explorer 8, 9, 10
- QlikView 11
- QlikView 11.2
2 Comments