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

How can I flag leaf nodes in a hierarchy?

Hey all. So I have a table that is a hierarchy, although I'm not loading it as a hierarchy table in QlikView. The table looks like this:

NodeId,

NodeName,

NodePath, // Delimited string including all nodes down to this one, e.g., Top\Branch\Branch\Leaf

NodeCode, // Numerical version of the above, e.g., 1.2.2.4

ParentNodeId,

RootNodeIt

So, is there a way for me to create a derived IsLeaf flag field? I'm assuming I'll have to run it through the hierarchy load first to get that. Any ideas?

Thanks,

Eric

1 Reply
hdonald
Creator
Creator

Hi,

How about adding the parent nodes to a mapping table and flagging any child nodes that are not in that table ?,

e.g.

Map_Parents:

MAPPING LOAD ParentNodeID,

0 as NotLeaf

FROM

HTable.xlsx

(ooxml, embedded labels, table is Sheet1);

HTable:

LOAD NodeId,

     NodeName,

     NodePath,

     NodeCode,

     ParentNodeID,

     RootNodeID,

     ApplyMap('Map_Parents',NodeId,'1') as LeafFlag

FROM HTable.xlsx

(ooxml, embedded labels, table is Sheet1);

Use the Qlikview Hierarchy load, instead of a normal load, if you want the 'expanded' node table format - see attached,

Regards,

HD