473,508 Members | 2,324 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

help with an ordered list

hi everyone. i'm trying to write asp to build an ordered list from a
database table. i'm running into issues with place holding.

here's an example of the data from the table..

id | parentID | file
1 | 0 | index.asp
2 | 1 | sub.asp
3 | 2 | subsub.asp
4 | 1 | sub2.asp
basically the way i have it, the parentID relates to the id of the list
item it should be located under. ie.

index.asp
sub.asp
subsub.asp
sub2.asp

and so on...

any idea how to get this kind of output to create a list like this?

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #1
2 1583
Look at coding a recursive routine. Basically pick up the records with no
parent node (ParentID IS NULL) - they're your top level nodes. Iterate
through them and call GetChildNodes (NodeID) where NodeID is the ID of the
node you're currently processing. Process each node (display it) and then
call GetChildNodes (NodeID) for that one, etc. Basically you're trying to do
a depth-first-search. You can use the depth of the recursion to provide help
with the indentation/formatting etc. Be careful though, these routines can
be expensive so optimise your code depending on your requirements.

Alan

"Kevin" <ke***@NOSPAM0type.com> wrote in message
news:e2**************@TK2MSFTNGP09.phx.gbl...
hi everyone. i'm trying to write asp to build an ordered list from a
database table. i'm running into issues with place holding.

here's an example of the data from the table..

id | parentID | file
1 | 0 | index.asp
2 | 1 | sub.asp
3 | 2 | subsub.asp
4 | 1 | sub2.asp
basically the way i have it, the parentID relates to the id of the list
item it should be located under. ie.

index.asp
sub.asp
subsub.asp
sub2.asp

and so on...

any idea how to get this kind of output to create a list like this?

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #2
"Kevin" <ke***@NOSPAM0type.com> wrote in message
news:e2**************@TK2MSFTNGP09.phx.gbl...
hi everyone. i'm trying to write asp to build an ordered list from a
database table. i'm running into issues with place holding.

here's an example of the data from the table..

id | parentID | file
1 | 0 | index.asp
2 | 1 | sub.asp
3 | 2 | subsub.asp
4 | 1 | sub2.asp
basically the way i have it, the parentID relates to the id of the list
item it should be located under. ie.

index.asp
sub.asp
subsub.asp
sub2.asp

and so on...

any idea how to get this kind of output to create a list like this?


In addition to Alan's suggestion you may also want to consider using XSL to
transform the link array (edge set) into a hierarchical tree. Here's an
example:

http://groups.google.com/groups?selm...TNGP12.phx.gbl

HTH
-Chris Hohmann
Jul 19 '05 #3

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

Similar topics

5
1844
by: Wang Tong | last post by:
I have the following code, which removes a pair (string, int) from the set. I defined a predicate that returns true if the string value matches. But I am getting compiler error on the remove_if...
33
3867
by: Jim Cobban | last post by:
I cannot get Netscape 4.79 to properly display the ordered list in the following fragment. <P>Get a specific portion of the date. Depending upon the value of index: <ol start=0> <li>complete...
4
6476
by: Ryan Ternier | last post by:
I have a section of my project that is Driving me nuts. No one has been able to help that much on it, so i thought of posting it here in hopes someone could help. I need to print out an...
210
10272
by: Christoph Zwerschke | last post by:
This is probably a FAQ, but I dare to ask it nevertheless since I haven't found a satisfying answer yet: Why isn't there an "ordered dictionary" class at least in the standard list? Time and again...
8
1653
by: Fuzzyman | last post by:
Sorry for this hurried message - I've done a new implementation of out ordered dict. This comes out of the discussion on this newsgroup (see blog entry for link to archive of discussion). See...
22
2336
by: bearophileHUGS | last post by:
>From this interesting blog entry by Lawrence Oluyede: http://www.oluyede.org/blog/2006/07/05/europython-day-2/ and the Py3.0 PEPs, I think the people working on Py3.0 are doing a good job, I am...
1
3310
by: rllioacvuher | last post by:
I need help with a program. I have implemented that following header file with an unordered list using one array, but i need to be able to use an ordered list and 2 arrays (one for the links and one...
0
2909
by: butterflyTee | last post by:
USING:ORACLE 9i For each of the following tasks, determine (a) the SQL statement needed to perform the stated task using the traditional approach and (b) the SQL statement needed to perform the...
47
2822
by: Jo | last post by:
Hi there, I'm Jo and it's the first time I've posted here. I'm in process of creating a database at work and have come a little unstuck.....I'm a bit of a novice and wondered if anyone could...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7118
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
7379
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...
0
7493
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5625
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1550
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.