Re: Need to Sort Multilevel Data List



Ron & Tom,

Thanks for your replies. Both of you are correct with your first
descriptions - I didn't attempt to mimic a table layout because I've
tried it before with horribly misleading results. Anyway here goes...

1.0.0 Description | Blank | Blank | 1.0.0 ID | Status | Priority |
Etc.
Blank | 1.1.0 Description | Blank | 1.1.0 ID | Status | Priority |
Etc.
Blank | Blank | 1.1.1 Description | 1.1.1 ID | Status | Priority |
Etc.
Blank | Blank | 1.1.2 Description | 1.1.2 ID | Status | Priority |
Etc.
Blank | Blank | 1.1.3 Description | 1.1.3 ID | Status | Priority |
Etc.
Blank | 1.2.0 Description | Blank | 1.2.0 ID | Status | Priority |
Etc.
Blank | Blank | 1.2.1 Description | 1.2.1 ID | Status | Priority |
Etc.
2.0.0 Description | Blank | Blank | 2.0.0 ID | Status | Priority |
Etc.
Blank | 2.1.0 Description | Blank | 2.1.0 ID | Status | Priority |
Etc.
Blank | Blank | 2.1.1 Description | 2.1.1 ID | Status | Priority |
Etc.
Blank | 2.2.0 Description | Blank | 2.2.0 ID | Status | Priority |
Etc.
Blank | Blank | 2.2.1 Description | 2.2.1 ID | Status | Priority |
Etc.

There are more columns of course but I am chiefly interested in
sorting by Status or Priority. I've put the hierarchy numbers
in for clarity - they don't actually exist but I could create them if
I thought it would help (which I don't at this point).

My latest idea is this (it appears to work on a small data set)...

1) To the right, add a column that simply contains the row number of
each row - this will be purely to allow me to restore the data to its
current state, which has hierarchical significance. Let's call it the
'Restore' column.

2) Sort the data by 'Status' (or whatever)

3) Add another column containing the row numbers as the list is now
sorted. Let's call it the 'Tag' column

4) Sort the data by the 'Restore' column

Now the clever bit - which I'm hoping will process fairly quickly...

5) Add a 'NewSort' column which will contain...
For Level1, the 'Tag' number
For Level2, the Level1 tag number + 0.00001 * its own tag number
For Level3, the Level2 tag number + 0.0000000001 * its own tag
number

6) Sort the data by 'NewSort' - Done!

Please let me know if you see any holes in my logic or if there's a
much simpler way that I'm missing.

Best regards,
NickH

PS. Loads of respect for you Tom - your a great contributor and I've
gained a lot of help from solutions that you've provided for others in
the past. :)

.



Relevant Pages

  • Re: cftbl vs tom vs swe1 vs shadow
    ... Put it this way--if you buy the TOM, I might buy it from you ... I've already got a nice Shadow. ... i always prefer fast paced, high action games to slow games ... a TC restore is going to run you. ...
    (rec.games.pinball)
  • Re: quick email change
    ... | Tom St Denis wrote: ... |>something like hashcash should have been added to smtp five years ago. ... based on the hashcash tag. ... Then the client can sort them based on the existance [and ...
    (sci.crypt)
  • Re: Hey, newbies and lurkers...
    ... what sort of music do you play and what sort of instruments do you got? ... Note to Tom Risner: The Fender is safe and sound. ... Get thee saved and play the guitar, or at least, a mandolin, we'd even settle for the ukulele. ...
    (rec.music.makers.guitar.acoustic)
  • Re: System Restore wont work
    ... Works in Safe Mode fine. ... "SC Tom" wrote: ... is successful, it'll start again on its own anyhow. ... SR UI allowing you to restore to a previous date. ...
    (microsoft.public.windows.vista.performance_maintenance)
  • Re: system restore fails periodically
    ... SC Tom wrote: ... message saying SR unable to restore to the selected point, ... but ERUNT is just a registry backup. ... Just out of curiosity, how old were the drives, and what were the warnings ...
    (microsoft.public.windowsxp.help_and_support)

Quantcast