Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Highlighted
Not applicable

Hierarchy function is not generating NodePath, only separators?

Hi all,

I am running hierarchy function on the resident table called DataTaxonomy_tmp3

Below the content of the table:

NodeDescription NodeID ParentID
Client 22
Counterparty Country of Risk Name 127 167
Exchange Price 126 168
Markets 168 21
Party 167 22
Pricing 21
TestKDE3 128 169
TestKDE4 129 168
TestSubdomain3 169 22
TestSubdomain4 170 21

Script used for Hierarchy:

DataTaxonomy:
Hierarchy(NodeID, ParentID, NodeDescription,ParentName,Node,SelectionPath,,NodeDepth)
LOAD NodeID,
ParentID,
NodeDescription
RESIDENT DataTaxonomy_tmp3;

It seems to create the correct table apart from the fact that the path is not populated correctly and only consists of separators (last column), table below:

NodeDepth NodeDescription NodeDescription1 NodeDescription2 NodeDescription3 NodeID ParentID ParentName SelectionPath
1 Client Client 22
1 Pricing Pricing 21
2 Markets Pricing Markets 168 21 Pricing /
2 Party Client Party 167 22 Client /
2 TestSubdomain3 Client TestSubdomain3 169 22 Client /
2 TestSubdomain4 Pricing TestSubdomain4 170 21 Pricing /
3 Counterparty Country of Risk Name Client Party Counterparty Country of Risk Name 127 167 Party //
3 Exchange Price Pricing Markets Exchange Price 126 168 Markets //
3 TestKDE3 Client TestSubdomain3 TestKDE3 128 169 TestSubdomain3 //
3 TestKDE4 Pricing Markets TestKDE4 129 168 Markets //

an anyone help and tell me what may be the reason for not populating the SelectionPath correctly?

Regards,

Paul

Tags (3)
1 Solution

Accepted Solutions
Not applicable

Re: Hierarchy function is not generating NodePath, only separators?

OK found the answer!

My original script (in my first post) should read Node Description.

DataTaxonomy:
Hierarchy(NodeID, ParentID, NodeDescription,ParentName,NodeDescription,SelectionPath,,NodeDepth)
LOAD NodeID,
ParentID,
NodeDescription
RESIDENT DataTaxonomy_tmp3;

Thanks for all the help!

10 Replies
Partner
Partner

Re: Hierarchy function is not generating NodePath, only separators?

Hi Paul.

there is no screenshot in the question. Anyway, it would be great if you attach a sample application that can be reloaded.

BR, Ioannis

Partner
Partner

Re: Hierarchy function is not generating NodePath, only separators?

PathSource is the name of the field that contains the name of the node used to build the node path. Optional parameter. If omitted, NodeName will be used. 

You have neither PathSource nor NodeName

Not applicable

Re: Hierarchy function is not generating NodePath, only separators?

Hi Ioannis,

Thanks -  have realised screenshots were not posted so have added tables, sharing sample app would require a lot of cleansing so would use that as a last resort if no one can suggest anything.

Paul

Not applicable

Re: Hierarchy function is not generating NodePath, only separators?

I have got a NodeName called NodeDescription,

That does not seem to be the case as if I run the script like this it still does not produce the path (just separators)

DataTaxonomy:
Hierarchy(NodeID, ParentID, NodeName,ParentName,Node,SelectionPath,,NodeDepth)
LOAD NodeID,
ParentID,
NodeDescription as NodeName
RESIDENT DataTaxonomy_tmp3;

Re: Hierarchy function is not generating NodePath, only separators?

There is a typo in your Hierarchy parameters:

try

Hierarchy(NodeID, ParentID, NodeDescription,ParentName,NodeID,SelectionPath,,NodeDepth)

instead.

hope this helps

regards

Marco

Not applicable

Re: Hierarchy function is not generating NodePath, only separators?

Thanks Marco for suggestion

I have run the code:

ierarchy(NodeID, ParentID, NodeName,ParentName,NodeID,SelectionPath,,NodeDepth)

but unfortunately no change,

Paul

Not applicable

Re: Hierarchy function is not generating NodePath, only separators?

Interesting, if I do the same script on exactly the same table but which was created using load * inline- it works!

Could it be something to do with numbers/text formatting?

Node Node1 Node2 Node3 NodeDepth NodeID ParentID ParentName SelectionPath
Client Client 1 22 22
Counterparty Country of Risk Name Client Party Counterparty Country of Risk Name 3 127 167 Party 22/167/127
Exchange Price Pricing Markets Exchange Price 3 126 168 Markets 21/168/126
Markets Pricing Markets 2 168 21 Pricing 21/168
Party Client Party 2 167 22 Client 22/167
Pricing Pricing 1 21 21
TestKDE3 Client TestSubdomain3 TestKDE3 3 128 169 TestSubdomain3 22/169/128
TestKDE4 Pricing Markets TestKDE4 3 129 168 Markets 21/168/129
TestSubdomain3 Client TestSubdomain3 2 169 22 Client 22/169
TestSubdomain4 Pricing TestSubdomain4 2 170 21 Pricing 21/170
Not applicable

Re: Hierarchy function is not generating NodePath, only separators?

OK found the answer!

My original script (in my first post) should read Node Description.

DataTaxonomy:
Hierarchy(NodeID, ParentID, NodeDescription,ParentName,NodeDescription,SelectionPath,,NodeDepth)
LOAD NodeID,
ParentID,
NodeDescription
RESIDENT DataTaxonomy_tmp3;

Thanks for all the help!

Re: Hierarchy function is not generating NodePath, only separators?

You're welcome

please close your thread if your question is answered.

thanks

regards

Marco