Skip to main content
Announcements
New: No-code data prep in Qlik Cloud Analytics™ TAKE A TOUR
cancel
Showing results for 
Search instead for 
Did you mean: 
Ori_Hait
Contributor II
Contributor II

Storing Hierarchy Tables

Hi everyone,

i've got a table of parent child relationships which i use the hierarchy function on to flatten it.

parent_child:

  sql
  SELECT ole.item_id AS "NodeId",
         ole.PARENT AS "ParentId",
         ole."name" AS "NodeName",
         ole.assignment_group as assignment_group,
         agd."name" as group_name 
  FROM tfm.org_logical_entity ole
  left join tfm.assignment_group_details agd
  on agd.snow_sys_id = ole.assignment_group
  ;

Hierarchy(NodeId, ParentId, NodeName, ParentName, NodeName, pathname, '\', Depth) 
load * resident parent_child;

drop table parent_child;

Problem is that I cant seem to find a way to refer to the columns created by that function in order to use them for script aggregations because qlik sense creates it with the "-ExpandedNodes" suffix to its name and the load script is having a hard time with the first dash on the left.

Thought about storing the table first but again, for the reason specified before, qlik doesn't react to well to using that character and I'm getting the following error 

The error occurred here:
store parent_child>>>>>>-<<<<<<ExpandedNodes into lib://Main_Connection/pacificlife_sr/ETL/DEV/parent_child-ExpandedNodes.qvd]

 

Has anyone encountered this error before? how did you overcome it?

Thanks!

Ori.

Labels (1)
1 Solution

Accepted Solutions
chriscammers
Partner - Specialist
Partner - Specialist

Try explicitly naming your table and then referring to that name.

parent_child:

  sql
  SELECT ole.item_id AS "NodeId",
         ole.PARENT AS "ParentId",
         ole."name" AS "NodeName",
         ole.assignment_group as assignment_group,
         agd."name" as group_name 
  FROM tfm.org_logical_entity ole
  left join tfm.assignment_group_details agd
  on agd.snow_sys_id = ole.assignment_group
  ;

[FlatHierarchy]:
Hierarchy(NodeId, ParentId, NodeName, ParentName, NodeName, pathname, '\', Depth) 
load * resident parent_child;

drop table parent_child;
Store FlatHierarchy into [file.qvd](qvd);

View solution in original post

3 Replies
chriscammers
Partner - Specialist
Partner - Specialist

Try explicitly naming your table and then referring to that name.

parent_child:

  sql
  SELECT ole.item_id AS "NodeId",
         ole.PARENT AS "ParentId",
         ole."name" AS "NodeName",
         ole.assignment_group as assignment_group,
         agd."name" as group_name 
  FROM tfm.org_logical_entity ole
  left join tfm.assignment_group_details agd
  on agd.snow_sys_id = ole.assignment_group
  ;

[FlatHierarchy]:
Hierarchy(NodeId, ParentId, NodeName, ParentName, NodeName, pathname, '\', Depth) 
load * resident parent_child;

drop table parent_child;
Store FlatHierarchy into [file.qvd](qvd);
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

If the table referenced in the store statement contains special characters, it should be enclosed in [] or "".

Store [parent_child-ExpandedNodes] into ...

-Rob

Ori_Hait
Contributor II
Contributor II
Author

So embarrassing, thanks 🙂