Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    Faifax, Virginia, USA
    Posts
    542
    Thanks
    0
    Thanked 0 Times in 0 Posts

    'Content based' sort order? (AXP 10.2627.2625)

    Not sure what to even call this idea...

    I have a list of school levels: PK, K, 1, 2, ... 8

    At the moment, i have a Student table with the grade name in each student's record. When I sort by grade, I get the usual alpha sort, but would prefer the PK, K, 1,.. order.

    I am thinking that to obtain the "grade name ordered sort", I need to reorganize the schema: make two tables, such that the Student table and the Grade Name tables are linked.

    Am i on the right track, or is there an easier way i am overlooking?

  2. #2
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: 'Content based' sort order? (AXP 10.2627.2625)

    I agree with your thoughts. The Grade Name table would also include a data field you could sort on. (i.e, create a grade name table with a field for Grade Number and then a field for sort order. When linking the tables, you could then sort on the sort order number to get the correct sort order.

    Being that there are a limited number of levels from PK to 8, you could also use an IF Then statement to help with the sort, however, I would go with the two tables.
    Regards,

    Gary
    (It's been a while!)

  3. #3
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: 'Content based' sort order? (AXP 10.2627.2625)

    I'm not sure if my suggestion is related to your train of thought or not. Here's what I would do: Create a separate field in the Grades table called GradeID. Make it a Number field - since the table will have a limited number of entries there shouldn't be a need for Autonumber. Number the items starting with 1 for PK, 2 for K, and so on.

    Include the GradeID field in your queries and sort by it, but don't show the data from it.

    Post back if you need further clarification for my random thoughts...HTH <img src=/S/salute.gif border=0 alt=salute width=15 height=20>

  4. #4
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    Faifax, Virginia, USA
    Posts
    542
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: 'Content based' sort order? (AXP 10.2627.2625)

    Thanks Gary & mark - that's pretty much what i thought, and did.

Posting Permissions

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