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

18 Replies
avinashelite

did you tried this

Hierarchy(NodeID,ParentID,NodeName, , , ,Path,'&',Depth) 3 blank fields ??


Currently I don't have the QV licence ...please share the table snapshot s from the model (Hierarchy table

Anonymous
Not applicable
Author

ServiceTimeSeries:

Hierarchy(NodeID,ParentID,NodeName,,,Path,'&',Depth)
Load
FCIGroup as ParentID,
Function as NodeID,
Function as NodeName,
'' as Status,
*;


LOAD
"Date" as "ServiceTimeSeries.Date",
if(WildMatch("Group",'*Payments*'),'Payments',
if(WildMatch("Group",'*Payroll*'),'Payroll',"Group")) as FCIGroup,
"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;

Exit script;

and here are the screen shots of the data , actually I don't find the Path field created in the script,

Anonymous
Not applicable
Author

Any help on this?

MarcoWedel

Hi,

try using

Hierarchy(NodeID,ParentID,NodeName,,NodeName,Path,'&',Depth)

and correct your data/logic as your Group and Function fields do not have too many common values, which they should to define a hierarchy. (In fact I didn't find a single common value).

QlikCommunity_Thread_208095_Pic1.JPG

QlikCommunity_Thread_208095_Pic2.JPG

hope this helps

regards

Marco

Anonymous
Not applicable
Author

What do you mean by common values it is supposed to be grouping by related values in database?

here I selected Billing , and its related values are shows in the data , I was expecting that there is going to be a main group Billing and its related values will appear in subgroup ..

MarcoWedel

I guess a hierarchy load is not what you are looking for.

Try

LOAD Group&'&'&Function as GroupFunction

...

instead. And use GroupFunction in your tree view list box using '&' as separator.

hope this helps

regards

Marco

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.

Anonymous
Not applicable
Author

Actually this was the first option I tried , but with this I am not able to select a Group value , please find the attached.Nothing happens when I select Group value

Anonymous
Not applicable
Author

Got it .. Thank you!