Results 1 to 3 of 3

Thread: Custom Sort

  1. #1
    3 Star Lounger
    Join Date
    Mar 2009
    Location
    Hong Kong
    Posts
    359
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How to sort a field by a custom order (eg, Jan, Feb, Mar,...etc.)?

    Armstrong

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    One option is to create a query based on the table and add a calculated column on which you can sort.

    If that is not possible, create a new table with two fields: the field on which you want to sort and a number field SortOrder in which you enter the desired sort order. For example, if you have regions East, North, South, West which you want to sort as North, East, South, West, the table would look like this:

    Create a query based on your table and on the new table, joined on the appropriate fields. Sort the query by the SortOrder field.

  3. #3
    3 Star Lounger
    Join Date
    Mar 2009
    Location
    Hong Kong
    Posts
    359
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='773242' date='01-May-2009 19:44']One option is to create a query based on the table and add a calculated column on which you can sort.

    If that is not possible, create a new table with two fields: the field on which you want to sort and a number field SortOrder in which you enter the desired sort order. For example, if you have regions East, North, South, West which you want to sort as North, East, South, West, the table would look like this:

    Create a query based on your table and on the new table, joined on the appropriate fields. Sort the query by the SortOrder field.[/quote]
    HansV,
    Thanks for taking time to show me the tricks. Both had come across my mind. Your post should confirm both are widely used technique for custom sort. Thanks for your help.
    Regards,
    Armstrong

Posting Permissions

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