I haven’t a clue if what I am trying to do is displayed correctly in my code below. What I ultimately would like to do is: when all of the data is pulled from the database (they are stored in the same column but some of the entries are on different levels) example: Column entries: & Levels Airline 1 Delta 2 Passengers 3 Baggage 4 What I would like to do is when this information is displayed on my website each level has to descend properly such as this when called from the database: Airline Delta o Passengers *Baggage Here is the code that I have so far: The bolded section is what I have having the most problems with I’m not even sure if I am writing the code properly? What I want it to do is call all the data display the first item (“airline“) then save it & call the next item (“deltaâ€) compare it to the first item, if the level numbers are different then save it under the first item (“airlineâ€) etc… Does this make sense? I’m not sure where to start…. Any help would be sooo greatly appreciated. Thanks in Advance!!! <% 'get Recordset, objRS dim objRS set objRS = server.CreateObject("adodb.recordset") dim y if request("goCat") = "Go" and request("txtSearchCategory") <> "" then y = FindLUCategoriesByName( request("txtSearchCategory"),(request("selDoc")), objRS) elseif request("showCat") <> "" then y = GetLUCategories("", objRS) elseif request ("selDoc") <> "" then y = GetLUCategoriesByLayer(objrs, request ("selDoc"), 2) else y = GetLUCategories("", objRS) end if [B]if objRS.eof then if request ("selDoc") <> "" then y = GetLUCategoriesByLayer (objrs, request ("selDoc"), 2) if layer >= 1 then objRS.MoveNext else end if [/B] Do While Not objRS.EOF category = objrs("CATEGORY_NAME") layer = objrs("LAYER_NUMBER") documentTypeId = objrs("DOCUMENT_TYPE_ID") categoryId = objrs("CATEGORY_ID") parentCategoryId = objrs("PARENT_CATEGORY_ID") dim counter counter = 0 loopCounter = loopCounter + 1 'Now loop through the recordset Fields For Each objField in objRS.Fields counter = counter + 1 temp = objField.value if objField.name = "CATEGORY_ID" then elseif objField.name = "CATEGORY_NAME" then if IsNull(objField.value) then temp = " " end if 'First, display the TABLE header info: Response.Write "<Table border=1 cellspacing=0 cellpadding=5 id=box>" 'Write the TR Response.Write "<TR>" Response.Write "<TD>" Response.Write "<ul>" Response.Write "<a href=category.asp?edit=categoryId" & ">" & Category & "</a>" Response.Write "<ul>" Response.Write "<li>" & Category & "</li>" Response.Write "</ul>" Response.Write "</ul>" Response.Write "</TD>" Response.Write "<TD>" & "</TD>" 'Close the TR tag Response.Write "</TR>" 'Close the table tag... Response.Write "</TABLE>" end if Next 'Advance the recordset objRS.MoveNext Loop end if objRS.close set objRS = nothing end if %> Code (markup):
If I understand you correctly, why not try something like this (just pseudocode, and you'd need another if .. then to close the </ul>): SELECT airline, level FROM table ORDER BY level Dim thisLevel As Integer = 0 Do While Not objRS.EOF If objrs("level") <> thisLevel Then Response.Write "<ul>" Response.Write "<li>" & objrs("airline") & "</li>" thisLevel = objrs("level") Loop Code (markup):
This code will create a new UL underneath the last one, nesting them deeper and deeper as the level changes. If you don't want to use ULs you could use padded TDs, etc.
Thanks for the reply, but in the table there isn't a column for "order level" the function I am calling is a stored procedure and in the stored procedure each item is separated by levels. so basically I'm totally lost in how to even call the different levels. I was thinking of first calling every item from that column on the page then have some code that will say if it's the first layer display then if every other layer below that is greater than 1 display below 1 etc.. but I haven't a clue how to do that.... .hope this makes sense? Thanks!
You want each level indented below the one above it, correct? Then maybe try this: <div style="padding-left: <%=10*yourLevelVariable%>px;"> So for a level of 1, the div will be indented 10 pixels from the left, for level 2 the padding will be 20 pixels, for 3 it will be 30 pixels, etc.
Well technically yes each level has to be indented below each other, but not all levels are the same. For example Airline would be assigned a level 1 delta level 2 passenger level 3 all this is done in the store procedure function that's being called from the database. So technically you can say that Airline is the parent delta is the child of airline passenger is the child or delta etc.. I'm soo new to ASP and vbscript that I haven't a clue how to make this function the way it's suppose to. would seeing the store procedure for this function help? Thanks again for your help!
I guess I still don't understand what you are trying to do. Your example shows Airline Delta Passengers Baggage Code (markup): The code I gave you will do this. If this is not what you want, please describe exactly what you are trying to accomplish.