Better Current Selections Box to Translate & Hide Fields (QlikTip #49)

This article demonstrates how to overcome some limitations of the standard Current Selections Box of QlikView: Translating field values, translating “hardcoded” labels of the Current Selections Box, hiding specific fields and customizing the icons shown.
The solution is based on a QlikView object extension I have created, called “Better Current SelectionsBox”.

Motivation

The Current Selections Box has some limitations which I am confronted quite often, probably because I am working in a non English speaking country (Germany).

  • It is not possible to translate the field names
  • The label of the two columns (“Fields” and “Values”) cannot be translated dynamically
  • It is not possible to hide specific fields
    (sure, you can use a single HidePrefix in QlikView but sometimes this is not enough)
  • While the Ajax Clients has some nice flat icons in the meantime, the Current Selections Box still displays some “older” 3D icons

Solution

Features Overview

Translation of Fields

Fields will be translated by referencing a loosely coupled table containing the translations. It was important for me to choose this approach because this can be combined with standard best practices to enable multiple languages within a QlikView applications on a per user/selection basis.

Example for loading the translations for each field:

Translations:
LOAD * INLINE [
    FieldName, FieldName_DE, FieldName_EN
    Dim1, Dim1 (DE), Dim1 (EN)
    Dim2, Dim2 (DE), Dim2 (EN)
    Dim3, Dim3 (DE), Dim3 (EN)
];

Languages:
LOAD * INLINE [
    Languages, LangKey
    Deutsch, DE
    English, EN
];

Then you have to set up your app as follows:

  1. Place a listbox for selecting the language on every sheet (using the field Languages).
  2. Create a variable with the name vSelectedLangKey with the expression =Only(LangKey)
  3. Configure the Better Current Selections Box as shown in the screenshot below

Language Configuration Properties

Property Setting Description
Fields FieldName Select the field name, FieldName is my example above
Expression =$(='FieldName_$(=vSelectedLangKey)) For the example above this will produce “FieldName_EN” if “English” is selected, “FieldName_DE” if “Deutsch” is selected

The Better Current Selections Box will then show the translated field names depending on the users language selection:

No Language Selected - Fallback Scenario

Language German selected - Fields are translated to German

Language English selected - Fields are translated to English


If a translation for a field name is not available the standard field name will be shown (default fallback mechanism).

Hiding Fields

There are two options to hide fields

  • Use Character Prefixes
  • Hide fields explicitely by setting their field names

Use the following properties to define which field you would like to hide:

Hide Fields in the 'Better Current Selections Box'

Property Example Description
Hide Prefixes _,%,HF Hide Prefixes, separated with a comma (,). A single HidePrefix can be a single character or more characters (as shown in the example above with “HF”, so all fields starting with “HF” will be hidden)
Hide Fields Languages,OtherFieldToHide Define the fields (by setting their field names) to be hidden in the Better Current Selections Box

An Example:

Hidden Fields Based on HidePrefixes and FieldNames

Icon Style

“Better Current SelectionsBox” supports different Icon Styles which can be chosen in the extension’s property dialog:

IconStyle Property

Icon Styles of the Better Current Selections Box

General Behavior

There are several options to set the general layouting behavior of the extension:

General Layouting Options

Property Description
Show Header

Show/Hide the column header
Show Values

Show/Hide the values of the current selection
Show Clear Icons

Show/Hide the clear icons
Note: If choosing this value, any standard selections box has to be place on the current sheet
Show Lock/Unlock Icons

Show/Hide the lock/unlock icons
Note: If choosing this value, any standard selections box has to be place on the current sheet
Show Status

Show/Hide the icon indicating the current status (selected/green & locked/blue)

This results into several possible rendering status of the Better Current Selections Box:

Full Feature Set

Hide Values

Hide Status Icon (Selections=Green/Locked=Blue)

Hide Header

Hide Clear/Lock/Unlock Icons

Hide Clear Icon

Download & Installation

Installation of the QlikView extension easy and straightforward, there is nothing special to take care of:

  1. Download the extension
  2. Install the extension on your local computer (doubleclick the .qar file)
  3. Drag’n’Drop the extension within QlikView Desktop (using WebView)
  4. Finally deploy the extension to your server (-> detailed instruction)

Known Issues / Limitations

Unfortunately …

Unfortunately there was not “direct” way to clear/lock a field without having this field used in a Listbox on the current sheet. So I have tried several workarounds: Finally I decided to use the most generic one. If you have “Show Clear Icons” or “Show Lock/Unlock Icons” enabled you’ll need a “Standard Current Selections Box” placed on every sheet where the “Better Current Selections Box” is used. Unfortunately.

If you “forget” to place a current selections box on the every sheet where the “Better Current Selections Box” is placed the user will see the following error message when clicking on the clear/lock/unlock icon:

If you choose “Show Clear Icons” and/or “Show Lock/Unlock Icons” place any standard “Current Selections Box” on the current sheet. You can hide the object (Show Condition = 0), so it will not be shown to the user, but the “Better Current Selections Box” relies on any Current Selections Box on the current sheet. Unfortunately …

Some issues in QlikView Desktop Client

I have experienced some issues in the QlikView Desktop Client when clicking on the clear icons, sometimes the clear command will not be executed correctly, but in the Ajax/Mobile client I have not experiences the same issues

Further limitations

  • Alternate States are not supported

Tested With

I have developed and tested this QlikView extension only for the following system:

  • Windows x86, x64
  • QlikView 11 SR2+, QlikView 11.2 SR1
  • Browsers:: Chrome 27, Internet Explorer 9, Firefox 20

Other versions may work fine, but I cannot guarantee …

Feedback, Bugs & Suggested Improvements

Please add feedback, bugs, suggested improvements below as a comment.

Bookmark and Share

and tagged , , , . Bookmark the permalink. Both comments and trackbacks are currently closed.

16 Comments

  1. Abhijit
    Posted May 30, 2013 at 11:43 | Permalink

    Excellent Contribution.
    many a times I need to hide some fields from current selection box.
    For all those fields, I need to set HidePrefix in the script.
    But condition is more worse when i realize of such a filed after data model is developed.
    So need to do the changes at script level also.
    Now onwards, Such tasks will be very much simple.
    Thank you.

    • Posted May 30, 2013 at 20:16 | Permalink

      Nice to read that, thanks for your feedback!

      Regards
      Stefan

  2. Martin Mahler
    Posted June 4, 2013 at 11:31 | Permalink

    Hey Stefan,

    first of all I would like to acknowledge that your contribution is very helpful and userfriendly.
    I have deployed your extension into my application and I have noticed that the functions (Clear, Lock etc.) will not work when there is more than one status box on the sheet (e.g. when comparing alternate states selections).

    Furthermore, it would be nice to be able to modify the cell widths or alternatively enable text wrapping, because the alternate field names are usually longer than the technical fields.

    Regards,
    Martin

    • Posted June 4, 2013 at 12:10 | Permalink

      Hi Martin,

      thank you for your feedback.
      I have just tried it and found it … Alternate States are currently not supported, I should mention this in the release notes. To get the extension up and running please add a Current Selections Box with the default state on your page …

      In the next release I have already added support for resizing the columns (you’ll find the source code on codeplex, but I have not updated the .qar-file, yet).

      Thanks for your additional suggestions …

      I’ll digg into it to support even alternate states …

      Regards
      Stefan

  3. Ivan Felipe
    Posted June 7, 2013 at 10:44 | Permalink

    Dear Stefan

    Thanks a lot for this great work. I’ve being experimenting a lot of issues associated to this handicap in many projects.

    We’ve been working hard in more than one customer, making a workaround to let visualize the name of the fields in the current selection box in an appropriate language.

    This has been a handicap to gain some projects.

    This extension will help, a lot.

    Regards
    Ivan

  4. Liat Todt
    Posted July 7, 2013 at 11:20 | Permalink

    Hi Stefan,
    I have tried to use the extension, however I have a problem.
    I followed the steps for using it and although all the selected fields have a translated value, it is not shown. However, when I make a selection of the field name from the translation table, the correct translated value is presented. I have tried using the expression that appears automatically when adding the extension (=Only($(=vSelectedLangKey))) as well as the expression from this page (=$(=’FieldName_$(=vSelectedLangKey))).

    I would love to hear your thoughts as why it happens and how it can be fixed.

    thank you Liat

    • Liat Todt
      Posted July 8, 2013 at 08:38 | Permalink

      Hi Stefan,
      I have finally figured out what is the source of the problem. The table Translations should contain all the fields that need translations and it can contain only 40 records. Any row above 40 the translated value will not show but the default value.
      Can it be fixed?
      Thanks Liat

      • Posted July 9, 2013 at 13:07 | Permalink

        Liat,

        thank you very much. Very good feedback.
        I have changed the default amount of rows (records) now to 500 records (by adding PageHeight=”500″ in the definition.xml). You can find the newest release with the version 1.0.2 again on CodePlex.

        Regards
        Stefan

        • Liat Todt
          Posted July 9, 2013 at 13:28 | Permalink

          Stefan,
          Thank you very much for the correction. It solved my problem and now the translation is presented properly. I really love your work.
          Liat Todt

  5. Jonathan Alm
    Posted February 27, 2014 at 15:50 | Permalink

    Hi Stefan,
    I have used your extension previously and it seems that it no longer works as intended when it comes to the clear and lock icons. (I am pretty sure that it worked okey last year).

    I have also downloaded your latest version and your example qvw-file and I can not get it to work there either.
    I click the clear icon in the “Better Current Selection-box” but nothing seems to happen. Neither in the “Better Current Selection-box” nor in the “standard” current selection box.

    Clicking on the clear icon in the “standard” current selection box works and it also removes the selection made from the “better current selection-box”.

    I have also experienced that if I select three dimensions and select to remove one of them (for example the 1st one), then the 2nd dimension is removed instead.

    Could this be related to QlikView 11.2 SR5?
    Kind regards, Jonathan

  6. Hemanth
    Posted March 26, 2014 at 20:20 | Permalink

    Hi Stefan,

    I have taken your extension and tried to customize for clearing the selections.
    Is there any way we can clear multiple selections at a time?
    Can you help me and let me know what need to changed in the below code to clear multiple row numbers.

    G.position = “0:” + rowNo + “:Body”;
    Qva.GetBinder(“”).Set(m + “.CD”, G);
    Qva.GetBinder(“”).Send(“”);

  7. Suvi
    Posted April 1, 2014 at 13:52 | Permalink

    Hi Stefan,
    Thank you, this is VERY useful! But, extension works only in Web view not in normal client view? I have 11.2 SR5 version.

  8. Shawn Hicks
    Posted April 28, 2014 at 18:03 | Permalink

    I am having the same issue as Jonathan Alm (Posted February 27, 2014 at 15:50 | Permalink)

    I have also downloaded your latest version and when have one feild in the selection box and I click the clear icon in the “Better Current Selection-box” nothing seems to happen. Neither in the “Better Current Selection-box” nor in the “standard” current selection box.

    Clicking on the clear icon in the “standard” current selection box works and it also removes the selection made from the “better current selection-box”.

    I have also experienced that if I select three dimensions and select to remove one of them (for example the 1st one), then the 2nd dimension is removed instead.

    Could this be related to QlikView 11.2 SR5? ( we recently upgraded)

    Please respond as this is a great tool and I want to put into production asap.

    • Posted April 28, 2014 at 20:20 | Permalink

      Hi Shawn,

      yes, it seems to be related to 11.2 SR5, I have also received some other emails (with other extensions) that they do not work in 11.2 SR5 …
      So I’ll have to investigate …

      Regards
      Stefan

  9. Omer
    Posted June 30, 2014 at 11:01 | Permalink

    Hi Stefan,

    I’m using Version 11.20.12354 SR6 64bit of Qlikview Dekstop.

    On the web client, when select a few fields, it only shows the latest selected after 3 selection. I would like to know if there is a newer version of this extension.

    Thanks.