B
Ben
Hi
We have the below details:
Order_Base
CustomerNo, OrderNo, OrderItemNo.....
Order_Detail
OrderItemNo, ParentItemNo, Desc......
Order_Detail.ParentItemNo is a FK for Order_Base.OrderItemNo
There is also the ability for Order_Detail.ParentItemNo to relate to another
higher level record of Order_Detail.ParentItemNo
(dont blame me for the database design)
We want to display these details in a Tree View:
1Order_Base
2 Order_Detail which relates to Order_Base (Order_Detail.ParentItemNo =
Order_Base.OrderItemNo)
3 Order_Detail which relates to parent record Order_Detail
(Order_Detail.ParentItemNo = Order_Detail.OrderItemNo)
4 Order_Detail which relates to parent record Order_Detail
(Order_Detail.ParentItemNo = Order_Detail.OrderItemNo)
5 Order_Detail which relates to parent record Order_Detail
(Order_Detail.ParentItemNo = Order_Detail.OrderItemNo)
6 Order_Detail which relates to parent record Order_Detail
(Order_Detail.ParentItemNo = Order_Detail.OrderItemNo)
The problem I have is that the quantity of sub items could go on forever,
the sql select statement for level 3 and beyond should be identical with
only the parent variable changed.
I am having problems creating re-usable code so that I can loop though them
past stage 2, my code currenlty has selected all items at level 1 and two
and they are all there fine. but how do I continue from here?
Any help would be very much appreicated
Thanks
B
We have the below details:
Order_Base
CustomerNo, OrderNo, OrderItemNo.....
Order_Detail
OrderItemNo, ParentItemNo, Desc......
Order_Detail.ParentItemNo is a FK for Order_Base.OrderItemNo
There is also the ability for Order_Detail.ParentItemNo to relate to another
higher level record of Order_Detail.ParentItemNo
(dont blame me for the database design)
We want to display these details in a Tree View:
1Order_Base
2 Order_Detail which relates to Order_Base (Order_Detail.ParentItemNo =
Order_Base.OrderItemNo)
3 Order_Detail which relates to parent record Order_Detail
(Order_Detail.ParentItemNo = Order_Detail.OrderItemNo)
4 Order_Detail which relates to parent record Order_Detail
(Order_Detail.ParentItemNo = Order_Detail.OrderItemNo)
5 Order_Detail which relates to parent record Order_Detail
(Order_Detail.ParentItemNo = Order_Detail.OrderItemNo)
6 Order_Detail which relates to parent record Order_Detail
(Order_Detail.ParentItemNo = Order_Detail.OrderItemNo)
The problem I have is that the quantity of sub items could go on forever,
the sql select statement for level 3 and beyond should be identical with
only the parent variable changed.
I am having problems creating re-usable code so that I can loop though them
past stage 2, my code currenlty has selected all items at level 1 and two
and they are all there fine. but how do I continue from here?
Any help would be very much appreicated
Thanks
B