Tree function. Need help....

Results 1 to 2 of 2

Thread: Tree function. Need help....

  1. #1
    Join Date
    Dec 1969

    Default Tree function. Need help....

    Hi!<BR><BR>I&#039;ve created a tree function which holds articles in the different levels. See below for DB structure:<BR><BR>ID (Auto), LEVEL, NAME<BR>1, 0, , Customer1_Root (Level 0 = root level for a customer)<BR>2, 1, , Hardware<BR>3, 1, , Software<BR>4, 3, , Microsoft<BR>5, 0, , Customer2_ROOT<BR>6, 5, , Networking<BR>7, 6, , NIC<BR>8, 6, , Hubs etc, etc...<BR>So the Customer is referenced to an his ROOT ID (for customer1 this is id "1").<BR>I&#039;ve created a SP that can display where the user is currently located in the tree.<BR><BR>Using this table structure, is it possible to graphically present a tree (microsoft style<BR>for example) with all his levels and sub-levels??<BR><BR>Any ideas on how it should be done? Any ideas, hints or references would be appreciated.<BR><BR>Cheers!<BR>Anders<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Tree function. Need help....

    You could include a leve field in your table that indicates the level of all new records.<BR><BR>To find the leve of a record, you take the value in the level field in the record&#039;s parent and add 1.<BR><BR>Now, to represent this in HTML:<BR><BR>Response.write "&#060;table&#062;"<BR>arrTree() &#039;loaded with the tree information<BR>For intCounter = 0 to UBound(arrTree)<BR>response.write "&#060;tr&#062;&#060;td&#062;"<BR>response.wri te "&#060;img src=""images/spacer.gif" width=" & arrTree(level) * 10 & ""&#062;"<BR>response.write arrTree(stuff)<BR>&#039;print text info from the array now<BR>response.write "&#060;/td&#062;&#060;/tr&#062;"<BR>Next<BR>Response.Write "&#060;/table&#062;"<BR><BR>In the above example, we insert a spacer gif with width = level * 10. You can change the last number to make the levels more or less prominent.<BR><BR>Good Luck...<BR><BR>Kurt

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts