Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Building a treeview/hierarchy with the mapping/applymapping function

Hi,

I am trying to build a treeview/hierarchy.

In my data set I have 10 departments and I can group my departments into sales zones and those sales zone into sales regions. The only data point I can select in my tree view is the actual department number. I cannot select zones (e.g. US) nor region (e.g. North America); as depicted in the attach.

The way I am constructing my hierarchy:

  1. Department are sourced from a DB
  2. Hierarchies are built with the help of inline tables.

2.1 step 1 is to define the mapping: e.g.

Mapping LOAD * Inline [

Dept, DeptMap

1,   "North America.US.East"

2,   "North America.US.West"

3,   "North America.Canada.East"

Etc… (in this case, East is department 1, West department 2, etc)

2.2 step 2 is to apply this mapping to my original department filed

applymap('depttree',Dpt) as dept_tree,

Since this didn’t work for me I tried mapping each department to each level of the hierarchy separately and then apply those to the original field. Didn’t work either.

What am I missing to get each level of the hierarchy selectable and actionable?

Many thanks! 

1 Reply
jcarpenter9
Partner - Creator
Partner - Creator

mister_mapko, did you solve this problem? I think the reason you can only select the bottom rows in the hierarchy is that the upper levels don't have a row in your data. The list view feature expects that every level in the hierarchy will be represented by a row in the underlying data structure. The upper levels will have a 'parent' that points to nowhere because they are at the top level.

Somehow you would need to insert rows into your data for North America, Canada, Asia, China, etc, with the appropriate hierarchy on each one. Then your tree view should be selectable from top to bottom.

~James