Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Data Model for "outline" format

Author  Topic 

webguru22
Starting Member

11 Posts

Posted - 2000-12-06 : 17:50:45
Hi SQL gurus,
Here's a twist on the old "threaded message board query" question:

I need to come up with a data modle that will let me have elements in an "outline" like this:

<pre>1.0 Top-level element

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.1 Second Level element
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.2 Second Level element
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.2.1 Third Level element
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.2.2 Third Level element
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.3 Second Level element
2.0 Top level element
&nbsp;&nbsp;&nbsp;&nbsp;2.1 Second Level element
&nbsp;&nbsp;&nbsp;&nbsp;2.2 Second Level element
&nbsp;&nbsp;&nbsp;&nbsp;2.3 Second Level element
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2.3.1 Third Level Element
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2.3.2 Third Level Element
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2.3.2.1 Fourth Level element
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2.3.3 Third Level Element
3.0 Top level element...

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

</pre>

And so on. The catch is, unlike a forum , there is no way to sort the elements by date, and to make it even more fun, I have to be able to select an element, and move it up or down in the heirarchy. So if I move element 2.3 up, it becomes 2.2, and 2.3.1 becomes 2.2.1, etc. And of course 2.2 becomes 2.3, swapping the spots in the heirarchy.

I'm not sure if I made this clear. I appreciate ANY advice. Mostly what I'm looking for is a data model that will et me sort the elements in this way. I can then figure out the logic for moving them up and down, etc.

   

- Advertisement -