Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Hierarchy - find Decedents

I know that you are able to to the HierarchyBelongsTo function to be able to see the full ancestry (parents, grand-parents, etc.) in a hierarchy.  I was wondering if anyone has thought of a good way to see all of the decedents (children, grandchildren, etc.) as well without seeing the "cousins"?

To explain this a little better imagine the following structure:

1. World

     2. North America

          3. United States

               4. Alabama

               4. Alaska

               4. Arizona

               ...

          3. Canada

               4. Alberta

               4. British Columbia

               ...

     2. Europe

          3. France

               4. Centre

               4. Limousin

               ...

          3. Spain

               4. Aragon

               ...

          ...

     ...

So, if I was to select North America, I would be able to see that it was connected to the following:

  • World (Parent)
  • United States (Child)
  • Canada (Child)
  • Alabama (Grand-child)
  • Alaska (Grand-child)
  • Arizona (Grand-child)
  • Alberta (Grand-child)
  • British Columbia (Grand-child)
  • Note - this would not be related to Europe or any of its "decedents" as these would be "cousins" not a direct Ancestor or Descendant

However, if I was to select United States, I would see that it was connected with the following:

  • World (Grandparent)
  • North America (Parent)
  • Alabama (Child)
  • Alaska (Child)
  • Arizona (Child)
  • Alberta (Child)
  • Note - this would not be related to Canada or any of its "decedents" as these would be "cousins" not a direct Ancestor or Descendant

Any thoughts on this would be much appreciated.

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

I could not rule out the expression, but it works the way you want it.

View solution in original post

6 Replies
Anonymous
Not applicable
Author

I could not rule out the expression, but it works the way you want it.

rubenmarin

Hi Todd, that kind of structures can be generated with the Hierarchy() function: https://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/ScriptPrefixes/Hierarc...

Not applicable
Author

Thank you very much.  It is not perfect (because of the expression that I think would be impossible to get rid of), but I do think that I could build off that and could find at least one relevant expression to add to the pivot table.  As a note, using the Hierarchy function, it seems you would build this pivot table with Node names that get created by the script (in this case it would be Node_Name1 - Node_Name4

gerrycastellino
Creator III
Creator III

Todd:

I had done a visual with hierarchy display:

check it out here:

A Different way of looking at Hierarchies

Not applicable
Author

Gerry - This is great.  Thanks for putting this together!

gerrycastellino
Creator III
Creator III

Todd:

I can help you deploy this solution in your organization - pro bono.

You might need some hand holding with the code...

FYI ...  this can be setup to handle multiple hierarchies,  with varying levels of depth.

gerrycastellino@sbcglobal.net