Skip to main content
Announcements
Qlik Community Office Hours - Bring your Ideation questions- May 15th, 11 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Tree view / hierarchy display

I have data that is actually survey response

It include 5 questions

Several possible answers

The display I like to achieve is:

Q1 >>> option 1 (100 users)

Option 1 (100 users) >>> message 2 >>> option 1(20 users)

                                                          >>> option 2 (70 users)

                                                         >>> option3 (10 users)

And so on….

What I’m trying to do is classification, in case user select one option what will be his probability to more for the next option in the tree.

this is what im using for loading the hierarchy.

data:
Hierarchy(id, question, menu_option,, menu_option,TreeView) Load
user_id,
id,
question,
menu_option,
if(menu_option =Male,1,if(menu_option =Female,2)) as gender
Resident input
;

Appreciate any advice on that subject.

Tomer

1 Solution

Accepted Solutions
whiteline
Master II
Master II

Oh, thats right. My mistake, all questions is relative to user_id.

Now i use string (user_id & '\' & question) as node id.

I think you should examine help manual for hierarhy tag:

The syntax is:

Hierarchy (NodeID,ParentID, NodeName, [ParentName], [PathSource],

[PathName], [PathDelimiter], [Depth]) (loadstatement | selectstatement)

Where

NodeIDis the name of the field that contains the node id.

ParentIDis the name of the field that contains the node id of the parent node.

NodeName is the name of the field that contains the name of the node.

ParentName is a string used to name the new ParentNamefield. If omitted,

this field will not be created.

PathSource is the name of the field that contains the name of the node used

to build the node path. Optional parameter. If omitted, NodeNamewill be

used.

PathName is a string used to name the new Path field, which contains the

path from the root to the node. Optional parameter. If omitted, this field will

not be created.

Your data should represent nodes of the tree and connections between them (http://en.wikipedia.org/wiki/Tree_(data_structure)).

So that they should have self id (question_complex_id) and parent node id (parent_question_complex_id).

Answering your question: parent id tells who is above this element in the tree.

View solution in original post

7 Replies
sreenivas
Creator III
Creator III

Can you post some sqample data

Not applicable
Author

added to the original post.

Thanks,

Tomer

whiteline
Master II
Master II

The problem is you don't have hierarhy in your data.

Look at the attached script. I've added 'parent_question' field.

Use this script and  list box wil show hierarhy of menu options based on subsiquent hierarhy of questions.

Not applicable
Author

Thanks,

I see the hierarchy but its look like most of the users grouped under one parent, in my case “Homen”,

Which I know should not be like that.

What this “parent_question” is actually doing? What the use of it?

If I understand maybe I can adapted accordingly.

Thanks

whiteline
Master II
Master II

Oh, thats right. My mistake, all questions is relative to user_id.

Now i use string (user_id & '\' & question) as node id.

I think you should examine help manual for hierarhy tag:

The syntax is:

Hierarchy (NodeID,ParentID, NodeName, [ParentName], [PathSource],

[PathName], [PathDelimiter], [Depth]) (loadstatement | selectstatement)

Where

NodeIDis the name of the field that contains the node id.

ParentIDis the name of the field that contains the node id of the parent node.

NodeName is the name of the field that contains the name of the node.

ParentName is a string used to name the new ParentNamefield. If omitted,

this field will not be created.

PathSource is the name of the field that contains the name of the node used

to build the node path. Optional parameter. If omitted, NodeNamewill be

used.

PathName is a string used to name the new Path field, which contains the

path from the root to the node. Optional parameter. If omitted, this field will

not be created.

Your data should represent nodes of the tree and connections between them (http://en.wikipedia.org/wiki/Tree_(data_structure)).

So that they should have self id (question_complex_id) and parent node id (parent_question_complex_id).

Answering your question: parent id tells who is above this element in the tree.

Not applicable
Author

Thanks a lot,

Now it seems to be ok.

Thank you for your reference I will do some reading.

Cheers,

Tomer

Not applicable
Author

Any suggestion what will be the best way to represent that in a graph?

Thanks