So,
My brain stopped working a little bit after noon but I need to get this finished up.
I'm using a recursive SQL query to get the data I need but I'm having trouble organizing it in Xbasic and then reformatting it to work with the tree control
Here is an example of the data I would be pulling in.
As you can see by the data, the top level Parent has 5 Children, then there are grandchildren and great grand children etc. I need to make the tree represent that. An example would be like the below:
So, among the different versions of stuff I tried, I've now just pulled this data into an array, thinking that might be the easiest.
It seems like every time I use array.find() or some other way to solve my issue though, it ends up not working right or I can't find enough documentation to figure it out.
Anyway, like I said, my brain is toast. Can someone give me a hand moving data from this array (which ends up looking just like the SQL Data) into a new array formatted for the tree control?
Thanks!
My brain stopped working a little bit after noon but I need to get this finished up.
I'm using a recursive SQL query to get the data I need but I'm having trouble organizing it in Xbasic and then reformatting it to work with the tree control
Here is an example of the data I would be pulling in.
Code:
PARNT CHILD PLev BA-100GAU 12 3132 - E1-210 1 BA-100GAU 12 5651 - D1-634 1 BA-100GAU 12 76128- D1-634 1 BA-100GAU 12 7902 - Z -880 1 BA-100GAU 12 841 -DAU-940 1 3132 - E1-210 R12 -H-210 2 841 -DAU-940 139 - D2-120 2 841 -DAU-940 26020- D2-210 2 841 -DAU-940 3347 -D2A-210 2 841 -DAU-940 3694 - D -210 2 841 -DAU-940 3820 - D2B753 2 841 -DAU-940 65150- D -993 2 841 -DAU-940 689 - D -470 2 841 -DAU-940 7423 - D -750 2 139 - D2-120 139 - DA-C20 3 26020- D2-210 R1332 -R-210 3 3694 - D -210 R12 -H-210 3 139 - DA-C20 139 - D -SHL 4 139 - DA-C20 R81 -A-120 4 139 - DA-C20 RB6 -A-003 4 139 - D -SHL SAND 5
Code:
+BA-100GAU 12 +841 -DAU-940 +139 - D2-120 +139 - DA-C20 R81 -A-120 RB6 -A-003 +139 - D -SHL SAND
Code:
..... if cn.Execute(SQL,args) then dim rs as SQL::ResultSet rs = cn.ResultSet dim r[0] as p while rs.NextRow() r.append() eval("r["+alltrim(str(plev))+"].Parent") = rs.Data("PARNT") eval("r["+alltrim(str(plev))+"].Child") = rs.Data("CHILD") eval("r["+alltrim(str(plev))+"].Level") = rs.Data("PLev") plev = plev + 1 end while ......
It seems like every time I use array.find() or some other way to solve my issue though, it ends up not working right or I can't find enough documentation to figure it out.
Anyway, like I said, my brain is toast. Can someone give me a hand moving data from this array (which ends up looking just like the SQL Data) into a new array formatted for the tree control?
Thanks!
Comment