First of all to start with I am Qlikview newbie and this is my first post in Qlikview Forum. Hope this helps you to resolve the ordering issues we face in listboxes that are dependent upon selections on another listbox:
Problem Statement: I had a requirement from my client where we needed to have a Listbox that would show a single name for a group of elements. For ex: Group_A would refer to Metric ids 1,2,5,7,8 11,13,14,15, Group_B would refer to Metric ids 3,6,9. Lets consider two groups for now.
So the First Listbox would basically contain two values Group_A, Group_B
Now based upon what I select(Group_A or Group_B) ,the second listbox should be able to filter out the Metric ids. Keep in mind the ordering for the respective Groups should always be same in the second listbox.
From the database prospective we just have one table(Table_A) that contains Metric ids, Metric Names,Metric Description. How will you resolve this?
In order to resolve the above problem statement. First we need to Edit the Script as below:
Load Metric_id,Metric_name,Metric_Desc, IF(match(Metric_id,1,2,5,7,8 11,13,14,15),'Group_A',if(Match(Metric_id,3,6,9),'Group_B')) as RULE_TYPE;
select * from <Schema_name>.Table_A.
Now on the Dashboard we will create two listboxes and a variable RULE_TYPE_VARIABLE:
First Listbox will have values from RULE_TYPE field(Group_A,Group_B). Then ,we will move to Settings-->Document Properties-->Triggers--> Click on Rule_Type --> Edit Actions--> Set variable--> Select variable--> RULE_TYPE_VARIABLE--> Set the variable definition as ( GetFieldSelections(RULE_TYPE)).
Now on the Second Listbox,we will use an expression IF(substringcount(RULE_TYPE,RULE_TYPE_VARIABLE)=1,Desc_Metric).
At last we will go to Sort properties and click on Ascending.
Hence, Now we have a listbox which is hierarchically dependent upon manual selections on previous Listbox.
Guys, if you have any better solution to the above problem please post it on the comments so that I can incorporate the same in my dashboard.