Can anyone please tell me how to use the hierarchy function in qlikview 11.0 and what is the use of this function? Also, If someone can paste the exact code with syntax with the explanation then it will be really helpful.
Solved! Go to Solution.
I would display this as two simple List boxes, one for Gender and one for Age. This way you will allow the user to make any selection representing intersections between selections in the two fields, e.g.: Gender=female AND (Age=10-20 OR Age=20-30).
If you squeeze both fields into one tree view (which most likely is possible with some script work) then you would not be able to make such selections.
The Hierarchy prefix unpacks an Adjacent Nodes table, i.e. a table that has one record per node and each node has a reference to its parent. The output of the Hierarchy prefix is an Expanded Nodes table, i.e. a table where each level has its own column.
Se further in the example.
Thanx Henric for the reply. But the problem is that if i open Winedistricts.qvw, then i will have to recover it because i have a qlikview personal edition and then i will not be able to open my orignal file. So, i will be very grateful to you if you can just copy and paste the heirarchy function from this file in your reply.
Have you tried to open it? It should contain an embedded license, so you shouldn't need to use any recover attempt.
okkk, you mean that if i have to create a heirarchy in my report then i will have to create an external file apart from my database file in which the heirarchy is defined in the way you have defined it in winedistrict.xls??
No, you should not have to have any external files if your DB contains a hierarchy table. You should replace the "Load ... From winedistricts.xls" with an appropriate statement that loads your hierarchy table.
But you may need to transform the hierarchy table while loading it. It all depends on the format of your hierarchy table.
ok, what should i do if i have to represent the data in my listbox in a treeview or like a directory structure?
For a tree-view list box, you need a path to the node, e.g. "The World/Europe/France/Bordeaux/Medoc/Bas-Médoc". Then you can set the listbox to tree view mode (ListBox properties - General - Show as Tree View).
The path field can be created in the Hierarchy statement: Use
Hierarchy (NodeID, ParentID, NodeName, ParentName, NodeName, Path, '/', Depth)
Can you explicitly tell me what i have to write in the following arguments to the heirarchy function:
I would write 'Path' and 'Depth'. These are both names of fields that are created by the Hierarchy statement and the parameters are used to name the new fields. Hence, they must not exist before.