Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Country Hierarchy as Treeview

Hi All,

I am trying to build a country hierarchy. Please help.

This is my data table where i have the country field.

SQL Select DEALER, COUNTRY,WAVE,...,....

From TABLE1 WHERE ENABLED='YES';

i created a below table and tried for country hierarchy

NODE_IDNAMEPARENT_ID
1ALL MARKETNULL
2GCC MARKET1
3Abu Dhabi2
4Bahrain2
5Dubai-SZR2
6Garhoud2
7Iraq2
8Jeddah2
9Jordan2
10Khobar2
11Kuwait - LR2
12Kuwait2
13Lebanon-JR2
14Lebanon-LR2
15Marrakech1
16Morocco1
17Oman2
18Qatar2
19Rabat1
20Casablanca1
21Riyadh2
22Sharjah2
23Tunisia1
24Algeria1
25Azerbaijan1
26Egypt1

Thanks.

1 Solution

Accepted Solutions
tresesco
MVP
MVP

My mistake. Try:

Hierarchy (NODE_ID, PARENT_ID, COUNTRY, Parent, COUNTRY, PathName)

Then use PathName. Else re-upload your sample qvw.

Update: Corrected the field reference

View solution in original post

15 Replies
tresesco
MVP
MVP

Try like:

Hierarchy(NODE_ID, PARENT_ID, NAME)

LOAD

      NODE_ID,

     PARENT_ID,

     NAME

From <>;

Then in the front end use treeview in list box with '/' separator.

Not applicable
Author

Hi,

I tried as below

COUNTRY_HIERARCHY:

Hierarchy (NODE_ID, PARENT_ID, NAME)

Select  NODE_ID,

PARENT_ID,

NAME

From XX_JLR_MS_COUNTRY ;

But how to link this with Country in below table

Select DEALER, COUNTRY,WAVE,...,....

From TABLE1 WHERE ENABLED='YES';

Thanks

tresesco
MVP
MVP

Well, try joing them like:

Tree:

Hierarchy(NODE_ID, PARENT_ID, COUNTRY)

LOAD

      NODE_ID,

     PARENT_ID,

     NAME as COUNTRY ;                  // Preceding load

Select COUNTRY From <>;

Join

Load * From <YourTreeTable>;

Not applicable
Author

Hi,

I tried and couldn't make it.

Please find the attached QV file.

Could you please help me.

Thanks

tresesco
MVP
MVP

Use pivot like in attached qvw. For better understanding read: Hierarchies

Not applicable
Author

Hi,

I need to display like this in a tree view. based this selection values should populate across all tabs.

All Market

  GCC

  KSA

country.png

Thanks.

tresesco
MVP
MVP

just add one more field in the hierachy like:

Hierarchy (NODE_ID, PARENT_ID, COUNTRY, Path)

Now in the front end use this Path listbox and use tree view with separator '/'

Not applicable
Author

Hi tresesco,

If i select ALL Market from Country list box it is not displaying the result in tables.

Thanks

Not applicable
Author

Path is empty.

Please help me to fix this issue

Thanks