Let’s say I have a table such as:
D_ID C_ID B_ID A_ID
1D 1C 1B 1A
4D 2C 6B 1A
6D 1C 1B 1A
9D 1C 1B 1A
8D 2C 6B 1A
And let’s say that structurally speaking, I know the following:
A's
B's
C's
D's
That is D’s are children of C’s, C’s of B’s and so on.
How could I turn the table up top into a hierarchical data source?
Such as
ID ParentID
1D 1C
4D 2C
6D 1C
9D 1C
8D 2C
1C 1B
2C 6B
1B 1A
6B 1A
1A Null
This could then serve as a hierarchical datasource for a Telerik TreeView or other hierarchical controls?
I know I could iterate over every item and build it myself, but I am wondering if there are better known ways to iterate this. Perhaps even a built in way to achieve this.
You could write a simple iteration passing through the file and adding pairs of elements to a dictionary. In pythonish looking psuedo code:
I hope this helps.