Results 1 to 15 of 15
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    McLean, VA
    Posts
    125
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Table sort problems (2000/SR1)

    I have tables containing numbered requirements that need to be sorted numerically (ascending). The requirement numbers are cross-references to the paragraph numbers of bookmarks. For a few days I swear Word 2000 was sorting the numbers perfectly, then all of a sudden it started giving strange results.
    I have attached a sample document. In the table. I would like the requirements to be ordered:
    1.1
    1.1.1.1
    1.1.1.1.1
    1.1.2
    1.1.3
    1.1.10
    I thought this would be the result I would get from a "Number, Ascending" sort on the column. As Table 1 in the attached file shows, this is not how Word sorts it.
    In Table 2, I simply keyed in the same numbers from Table 1, so that they are no longer cross-references to bookmark paragraph numbers. Word also sorts this table incorrectly ("Number, Ascending" option again), although the result is not the same as the one it gave in Table 1.
    Does anyone know what's going on, and whether it's possible to numerically sort a table based on a column containing cross-references to bookmark paragaraph numbers?
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Table sort problems (2000/SR1)

    > This is not possible with Word's autonumbering though

    This can be done with heading numbering, see <post#=327334>post 327334</post#> for an example.

    StuartR

  3. #3
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Table sort problems (2000/SR1)

    Good catch Stuart - I didn't bother checking that first and have been caught out. That should give the original poster a simpler solution if the cross-reference table is already built and the document will not be heavily modified in the future.

    I would still recommend investigating the suggested TOC method though because creating and updating a TOC is a whole lot easier than trying to build and maintain a list of cross-references to numbered paragraphs which contain requirements.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  4. #4
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Table sort problems (2000/SR1)

    <P ID="edit" class=small>(Edited by Andrew Lockton on 15-Apr-05 15:59. Must investigate assumptions before shooting mouth off.)</P>This is standard behaviour. All the office products sort these series of strings as Strings (alphabetically) rather than Numbers like you would like. This is pretty reasonable (albeit annoying) since traditional numbers don't have multiple decimal points.

    The way around this is usually to pad the numbering with leading zeros so that the numbers appear like this.
    1.01
    1.01.01.01
    1.01.01.01.01
    1.01.02
    1.01.03
    1.01.10

    This is not possible with Word's autonumbering though <font color=red>{Wrong Assumption - see Stuart's post}</font color=red> so you have to come up with VBA code which takes the table you want to sort and
    1. Adds a temporary column to the table
    2. Populates this column with the numbered column padded with zeros
    3. Sorts the table on the temp column
    4. Deletes the temp column.
    The code to pad the numbering has been posted in Access and Excel forums in the past - usually for sorting WBS (Work Breakdown Structures). Adapting such code would provide you with a workable solution.

    Thinking laterally, it is probably easier to create the table you want in another way that is less problematic and less labour intensive to create and maintain the cross-referencing table too. Do you actually have requirement numbers displayed in your doc or are you just using the paragraph numbering and choosing which paragraphs contain a requirement? If so, perhaps each requirement number could use a character style to make it stand out (or keep it hidden). A macro could easily create TOC entries for each of these entries and then you could build a TOC of requirement numbers which automatically creates the list in the correct order.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  5. #5
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Table sort problems (2000/SR1)

    Andrew,

    I spent a bit of time last night trying to do this with a TOC, but I wasn't successful. I was trying to use Style Separators between the Heading numbers and the heading text, but couldn't get the behaviour I wanted. I think you're right that this could be made to work, and I would love to see the solution.

    StuartR

  6. #6
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Table sort problems (2000/SR1)

    I tried Character styles first but I couldn't build a TOC on character styles unless it was applied to the entire paragraph. The Style Separator may not work for this user as he quoted Word 2000 SR1 as his version.

    Knowing how requirements are usually listed (may be more than one requirement inside one paragraph) I would guess that this may not be doable with styles alone anyway.

    Without seeing the real file being used, and assuming that the poster has already done the labour intensive part of constructing this crossref table then I think the padded heading numbers should give them a relatively painless quick fix.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  7. #7
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Table sort problems (2000/SR1)

    Attached is a rework of the original file showing how it could be done with TC fields. If the tagging was automated then this would be a simple document to maintain into the future. I don't think that the macro would need to be very complex but it would be easier if there was something consistent to mark out what exactly is a requirement number.
    Attached Files Attached Files
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  8. #8
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Table sort problems (2000/SR1)

    Andrew,

    Maybe it's me, but that looks like the original word document with no TC fields <img src=/S/confused.gif border=0 alt=confused width=15 height=20>

    StuartR

  9. #9
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    McLean, VA
    Posts
    125
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re: Table sort problems (2000/SR1)

    Stuart / Andrew:
    Thanks to both of you for your input. I just met with the tech writer of the document.
    Stuart, padding the requirement numbers with leading zeroes is not an option. The tabled requirements are taken from ReqPro and no changes to the numbering are acceptable. I'm assuming there is no way to use your method and somehow hide the zeroes.
    Andrew, I can see that you added a TOC which orders the numbers correctly, but I don't see how you used TC fields to do so. Also, I don't see how I could integrate such a TOC into the actual table, which has 6 columns (my sample doc only included a small example of column 1). The way I understand how your method would work is that I would overwrite my column 1 with the results of the TOC. But if I did so, wouldn't all the data in the remaining columns be mismatched to what's in column 1? For example, column 2 includes cross-refs to all the bookmark texts.
    Also, no one has commented on why the two tables in my attachment produced different results when sorted in identical ways.

  10. #10
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Table sort problems (2000/SR1)

    I don't understand the different sort order in your two original tables.

    The only remaining solution I can think of is to write a Macro to generate the exact data you want in the order you want it sorted, and to bookmark the table column so you can delete the cell contents and regenerate them when needed.

    StuartR

  11. #11
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Table sort problems (2000/SR1)

    <P ID="edit" class=small>(Edited by Andrew Lockton on 16-Apr-05 11:16. Tested the sorting further)</P>The TC fields are hidden text - you need to reveal hidden text to see them.

    If there is other stuff in the table then the TC method isn't going to be useful but there are still different options to investigate to get this table sorted:
    1. Get ReqPro to put them in the right order since it built the table in the first place
    2. Change the autonumbering to pad the digits, update the cross-refs, sort the table, change the autonumbering back to the original pattern
    3. Copy the entire table to Excel, add a column which contains a formula to pad the digits, paste this extra column back into Word, sort on this column and then delete it
    4. Write a macro to do the same as option 3 but staying in Word
    5. Get the techwriter to do it

    The tables both sort the same way for me - perhaps you used different sorting methods with them (text vs date vs Numbers) - they give different results.
    Hang on - when I sort the table as text or dates then two tables give the same result but not when I sort as numbers. I have no idea why this doesn't give the same sorting result.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  12. #12
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Table sort problems (2000/SR1)

    I had another look at your two original tables, trying to understand the sort order.

    It isn't actually sorting the two tables differently. What it is doing (that I still don't understand) is sorting 1.1.1.1.1 and 1.1.3 to exactly the same place. These two entries remain in the same order as they started before the sort. If you move either of them to the top of the table and resort then it will remain above the other at the end of the sort!

    Both tables behave exactly the same, the only difference is that one of them happened to have these two entries in a different order to the other before the sort started.

    StuartR

  13. #13
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    McLean, VA
    Posts
    125
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re: Table sort problems (2000/SR1)

    Thanks, Andrew. Using the autonumbering to pad the digits and then changing them back to the original format later sounds like a good idea.

  14. #14
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    McLean, VA
    Posts
    125
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re: Table sort problems (2000/SR1)

    Stuart,
    My table sort isn't performing that way. The 1.1.1.1.1 and 1.3 entries are not staying in the same place. Maybe it has something to do with the version of Word.
    We'll simply have to consider this to be another interesting undocumented Word feature. Thanks again for looking into this for me.

  15. #15
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Table sort problems (2000/SR1)

    1.1.1.1.1 isn't really a "number" so I guess that Word is entitled to use any sort order it wants when you tell it to sort this as a number.

    StuartR

Posting Permissions

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