Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Tree view selectable node parent

hi guys i'am a little new with this so my problem how can i create a TreeView with Hierarchy, my Tree it's simple is:

I already tried some tutorials with hierarchy load but something is not right with the syntax, i also made the treeView with this expression

=AllRegions & '/' & Region & '/' & RaiserPlantName i cant select the parents.

This is my script to Load the Regions and Continents:

LOAD * INLINE [

    AllRegions, Region

    Global, AP

  Global, EU

  Global, NA

  Global, SA

];

LOAD * INLINE [

    Region, RaiserPlantID

    EU, 351E

    NA, 179B

    NA, 179A

    NA, 295A

    NA, 1215

    NA, 1225

    SA, ALTAA

    AP, 604E

    AP, 710B

    AP, 710A

    AP, 6605

    AP, 6865

];

LOAD * INLINE [

    RaiserPlantID, RaiserPlantName

    351E,  Palmela

    179A,  Carolinas

    179B,  Saucito

    ALTAA, Manaus

    295A,  VDSO

    1215,  NA Aftmkt - 1

    1225,  NA Aftmkt - 2

    604E,  VASI

    6605,  VEK

    710A,  VHP

    710B,  VJL delivery

    6865,  VETL

];

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

Then do it the other way around: Keep NodeID as it is, and add a

     RaiserPlantID as NodeID

in the table you want to link.


HIC

View solution in original post

6 Replies
hic
Former Employee
Former Employee

You need to have one table for all nodes, with one record per node. E.g.

Load * inline

[NodeID, ParentID, NodeName

Global, , Global

AP, Global, AP

EU, Global, EU

351E, EU, Palmela

6865, AP, VETL

...];

When you load this using the Hierarchy prefix, the Path field will be created, e.g. Global/EU/351E, and this you can use in a Tree-view list box. It is important that all nodes are listed in this table, also the upper ones, otherwise you will get nodes that are visible but not selectable.

See more here:

Unbalanced, n-level hierarchies

Hierarchies

HIC

Not applicable
Author

Hi, thanks for the help, you offer so much help with so few words

Not applicable
Author

Now i've another problem, my AllRegions, Region and RaiserPlantName are not connected to the other table, my new table seems allright and the path is correct but when i select i does nothing because there is no connection with primary key.

Hierarchy:

Hierarchy(NodeID, ParentID, NodeName,ParentName,NodeName,NodePath,'/',NodeDepth)

Load * inline

[NodeID, ParentID, NodeName

Global, , Global

AP, Global , AP

EU, Global , EU

NA, Global , NA

SA, Global , SA

351E, EU , Palmela

179A, NA , Carolinas

179B, NA , Saucito

ALTAA, SA , Manaus

295A, NA , VDSO ,VDSO

1215, NA , NA Aftmkt - 1

1225, NA , NA Aftmkt - 2

604E, AP , VASI

6605, AP , VEK

710A, AP , VHP

710B, AP , VJL delivery

6865, AP , VETL

];

hic
Former Employee
Former Employee

Then you shouldn't call the key "NodeID". Call it what it is called in the other tables, e.g.

Hierarchy(RaiserPlantID, ParentID, NodeName,ParentName,NodeName,NodePath,'/',NodeDepth)

Load * inline

[RaiserPlantID, ParentID, NodeName

....

HIC

Not applicable
Author

Yes but the nodeID will have values from the 3 diferent sources, All Regions -> Regions -> RaiserPlant if change NodeID by RaiserPlant i will have Regions as Plants in the same list

hic
Former Employee
Former Employee

Then do it the other way around: Keep NodeID as it is, and add a

     RaiserPlantID as NodeID

in the table you want to link.


HIC