Qlik Community

QlikView Documents

Documents for QlikView related information.

Users can map/group dimensions at run-time!

Employee
Employee

Users can map/group dimensions at run-time!

Sometimes the business users want to group some selected field values into a new name at runtime, on the fly. This is no standard functionality, but here is a solution approach.

>> See my attached SWF video for a 3 min demonstration.

Keep in mind, mappings done at runtime are just "private mapping" of one user and just valid during one session. (I can think of ways to store and recall this for later sessions, too, but this is not contained in this example)

--> In a standard situation, mappings are done centrally by the developer and exeuted during reload script run. Dimension values are then stored in the data model, valid for all users.

In this app

  • you can dynamically group customers (technical field name is Kunden.Kundenname) together under a new group name in the frontend (Ajax-Client, Plug-In)
  • You can select the new group name in a list box which will grow as you keep adding more groups
  • You can remove single mappings or
  • clear all mappings and restart

How is this done?

This app stores mappings into two variables, each of which has an equally long list of values: vSearchVal and vReplaceVal. I also introduced a Drill-group, which shows on first level the customer names, if they are not part of a group, or the runtime group name. But when you click on just the group name, the second level will show such customers belonging to the group (standard drill-group behaviour).

I needed to introduce some formulas as calculated dimension to manage this. The functions PICK() and MATCH() achieve the search/replace. Those who can't wait to download the app and look into the Drill-Group definitions, here is the expression for the calculated dimension:

=Pick(1 + Match(Kunden.Kundenname $(vSearchVal)), Kunden.Kundenname $(vReplaceVal))


(Kunden.Kundenname is the customer field.)


Related articles
ABC Analysis to set and remember classification at runtime


New version (01-Oct-2014):

This version stores the dynamic mappings also into bookmarks. On document level, there was a setting per variable to be part of bookmarks or not. The default is, not to store variables in bookmarks. I changed it for vSearchVal and vReplaceVal


Enjoy

Christof

Attachments
Comments
ses
Contributor

Love it! Simple, elegant solution.

Employee
Employee

Love it too !

lft
New Contributor III

Hi Christof!

Very elegant solution indeed.

I have one question : have you found a way to enable a customer to be part of two groups ?

Thanks

Regards,

Loic

lft
New Contributor III

Sorry I have found the solution myself.

You can use the following calculated dimension :

=Aggr(If(Kunden.Kundenname = Pick(SR_Index $(vSearchVal)), Pick(SR_Index $(vReplaceVal))), Kunden.Kundenname, SR_Index)

Regards,

Loic

phaneendra_kunc
Valued Contributor III

Is there a way to save the groupings that user will create in bookmarks.

My intention is lets say user created 10 groupings today and he wants to access lets say for 10 more days. if

so that he doesn't need to re-create them again.

Employee
Employee

Yes, I uploaded a new version that does that. This is a setting on document level per variable.Screenshot 2014-10-01 18.53.15.png

phaneendra_kunc
Valued Contributor III

Thanks So Much...It works exactly what i want. you are a Genius

Employee
Employee

In fact, I didn't know until today. I was presenting this at the Masters Summit for QlikView today and told the audience, I am not aware of storing variables into bookmarks. After my pres, a guy came and showed me, so this laurels belong to him ... ;-)

veidlburkhard
Contributor III

Hi Christof,

I love your method of dimension grouping and have a nice application where I use it. But I have one question. How do you deal with two groups having one or more 'customers' in common? The double used customer values are selected with the first group only. When you select the second group these customer(s) are missing!?! See example below

ModelGrouping.jpg

Would be nice to get a solution to this problem.

Regards

Burkhard

Version history
Revision #:
1 of 1
Last update:
‎03-13-2014 09:05 AM
Updated by:
Employee