473,387 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Displaying Preorder Tree Traversal Hierarchy in ASP?

I've been reading up on Modified Preorder Tree Traversal and it's
definitely ideal for the kind of tree structures I need to model for my
company's multi-level sales hierarchy. I've implemented the database
side already in SQL Server 2000 and can retrieve all child nodes based
on the left and right IDs of the current node. My problem is displaying
the tree so that correct indentation can be used to show the
relationships between the parents and their respective child nodes.

I'm aiming for this type of display:

Organic_Produce
- Fruit
- Banana
- Cherry
- Orange
- Vegetables
- Potatoes
- Savoury Potatoes
- Sweet Potatoes
- Zucchini

etc.

Now, I know a recursive function of some sort is needed, and I read on
this page http://www.sitepoint.com/print/hiera...-data-database how
to create the function in PHP, however I don't have the first clue how
to translate this into VBScript for implementation in ASP. If anyone
has perhaps an example of how a function to display MPTT-type
hierarchical data via VBScript, I will greatly appreciate any
assistance you might be able to offer.

Thanks in advance!
Frank

Feb 13 '06 #1
2 2777
Can anyone help me on this?

Feb 14 '06 #2
>I've been reading up on Modified Preorder Tree Traversal and it's
definitely ideal for the kind of tree structures <snip>Now, I know a recursive function of some sort is needed


Actually I think the whole point of the left right values in this technique
is to avoid having recursive functions which can become very slow.

All you need is a single recordset ordered by Left. The code is something
like this:-

Dim lLastLeft
Dim lDepth
Dim alRight

lDepth = 0

lLastLeft = rs("left")

ReDim alRight(4)
alRight(lDepth) = rs("right")

RenderRecord rs, lDepth
rs.MoveNext

Do Until rs.EOF

Do Until alRight(lDepth) > rs("left")
lDepth = lDepth - 1
Loop

If lDepth = UBound(alDepth) Then ReDim Preserve alRight(lDepth * 2)
lDepth = lDepth + 1
alRight(lDepth) = rs("right")

RenderRecord rs, lDepth

rs.MoveNext
Loop

Anthony.
Feb 18 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: ravi mannan | last post by:
Hello all, I'm trying to read an xml file and create a nested JPopupMenu from that. The first thing I want to do is to read in the xml file and put it in a Document using DOM and then do a...
9
by: David Méndez | last post by:
Hi, If I have the preorder and inorder list, which algorithm does I need to build the corresponding B-TREE? where can I find some source code? thanks -- comp.lang.c.moderated - moderation...
7
by: sugaray | last post by:
the binary search tree node here contains another structure as it's data field, programs did successfully work when data field is int, char, this time i got stucked, don't know why ? if there's...
2
by: RAJ | last post by:
In our multi-tier application, we have several ASP.NET user controls which will update the same data source provided by middle tier logic. In this particular scenario we have one user control...
22
by: delraydog | last post by:
It's quite simple to walk to the DOM tree going forward however I can't figure out a nice clean way to walk the DOM tree in reverse. Checking previousSibling is not sufficient as the...
13
by: hornedw | last post by:
I have been working on a ecommerce website for myself. What I needed some assistance on was when i was trying to display the categories/subcategories for the different products. I decided to use...
4
by: APEJMAN | last post by:
would you please help me with this question? I know that a binary tree can be recovered from its pre-order traversal. That is, a tree built from the pre-order traversal should always be the same as...
2
by: slizorn | last post by:
hi guys, i need to make a tree traversal algorithm that would help me search the tree.. basically i need to read in a text file... shown below H H,E,L E,B,F B,A,C A,null,null c,null,D
2
by: slizorn | last post by:
hi guys, i need to make a tree traversal algorithm that would help me search the tree.. creating a method to search a tree to find the position of node and to return its pointer value basically i...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.