Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Creating Hierarchy with 2 Fields

Hi

I almost see the all Hierarchy examples with 3 fields I mean with 3 levels , Can someone please post an example of it with just 2 fields ,

I have 2 fields - Group and Function , Group is ParentId and Function is Child/Nodeid , I need to create a list box with Tree view structure .. which is used as a filter.

Thanks

1 Solution

Accepted Solutions
swuehl
MVP
MVP

If I understood correctly, you don't need a Hierarchy Load then, just create a new concatenated field to build the tree:

TREE:

LOAD Group & '/' & Function as Tree, Group, Function

INLINE [

Group, Function

Billing, renew

Billing, Subscribe

];

Concatenate (TREE)

LOAD Group as Tree, Group , Function

RESIDENT TREE;

Now use Tree field in the list box and enable tree view option.

View solution in original post

18 Replies
avinashelite

In Hierarchy , every example has 3 field because 2 will be ID field and 1 will the name associated with that ID which will help you to easily identify the ID's with the name ..in your case try like this

Hierarchy (Child/Nodeid, Group , Child/Nodeid)

Not applicable
Author

Hi Ramya ,

Have a nice day.

folloe the link

Hierarchy in QlikView

Anonymous
Not applicable
Author

Here is how I have written the script , can someone help me.. where I am going wrong , I don't get any value in Path field.. I have tried with & and / .. I just get blank path field

Table1:
load
"Date",
"Group",
if(Isnull("FC"),'0',"Count")as "Count1",
if(Isnull("FC"),'0',"FC")AS "FC1",
"Count",
"FC",
"Service API",
"FCI",
"RYG_FCI",
"RYG_TP99",
"SLA_FCI",
"SLA_TP99",
"TP50",
"TP90",
"TP99",
"TP999"
;

SQL SELECT *
FROM "Operational Xcellence: Services Time Series bjznuur2b";

ServiceTimeSeries:
Hierarchy(NodeID,ParentID,NodeName,Path,'&',Depth)
Load
"Group" as ParentID,
"Function" as NodeID,
"Function" as NodeName,
if(WildMatch("Group",'*Payments*'),'Payments',
if(WildMatch("Group",'*Payroll*'),'Payroll',"Group")) as FCIGroup,
''
as Status,
*;


LOAD
"Date" as "ServiceTimeSeries.Date",
"Group",
"Service API" as "Function",
(
"Count1") as "RequestCount",
(
"FC1") AS "FCCount",
(
"Count") as "RequestCount_All",
(
"FC") AS "FCCount_All",
"FCI",
"RYG_FCI",
"RYG_TP99",
"SLA_FCI",
"SLA_TP99",
"TP50",
"TP90",
"TP99",
"TP999"
Resident Table1 where "Date" >= '9/1/2015';
Drop Table Table1;


kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi You can below script.


Hierarchy(NodeID,ParentID,NodeName,ParentName,NodeName,Path,'&',Depth)
Load
"Group" as ParentID,
"Function" as NodeID,
"Function" as NodeName,
if(WildMatch("Group",'*Payments*'),'Payments',
if(WildMatch("Group",'*Payroll*'),'Payroll',"Group")) as FCIGroup,
''
as Status,
*;


Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
avinashelite

try like this

HIERARCHY(GEOG_KEY, PARENT_KEY, GEOG_DESC, [GEOG PARENT NAME], GEOG_DESC, [HIERARCHY

GEOG], '|', 'HIERARCHY DEPTH')

ServiceTimeSeries:
Hierarchy(NodeID,ParentID,NodeName,,,Path,'&',Depth)
Load
"Group" as ParentID,
"Function" as NodeID,
"Function" as NodeName,
if(WildMatch("Group",'*Payments*'),'Payments',
if(WildMatch("Group",'*Payroll*'),'Payroll',"Group")) as FCIGroup,
''
as Status,

Anonymous
Not applicable
Author

By running the script Avinash gave I still get blank Path ,

By running Kaushik's script I get some values but not as a Tree view and they don't seem to be right , I have selected & in the list box presentation

Attached my App .. the Data in the Function is Bit tricky it has lots of / that's the reason I chose & to split the data

Not applicable
Author

Hi Ramya,

GEOGH:

HIERARCHY(ParentId, NodeId, NodeName, [GEOG PARENT NAME], NodeName, [HIERARCHY

GEOG], '|', 'HIERARCHY DEPTH')

LOAD


Group as ParentId,

Functionas as NodeId,

Functionas as NodeName

if(WildMatch("Group",'*Payments*'),'Payments',
if(WildMatch("Group",'*Payroll*'),'Payroll',"Group")) as FCIGroup,
''
as Status,

From

[..\..\Downloads\DataHierarchy.xlsx]

(ooxml, embedded labels, table is HIERARCHY);

Untitled.png

Anonymous
Not applicable
Author

I get a syntax error with the above script , can you please take a look at the attached app script? IF any one trying to check my app , it has an alternate state for the Tab just for info as adding new objects to the sheet might not show data unless its in default state.

Not applicable
Author

Sorry ramya i am using personal edition.

Wait for more answers