• Custom Sort

    • This topic has 2 replies, 2 voices, and was last updated 16 years ago.
    Author
    Topic
    #459517

    How to sort a field by a custom order (eg, Jan, Feb, Mar,…etc.)?

    Armstrong

    Viewing 0 reply threads
    Author
    Replies
    • #1158813

      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:

      [table=Table for sort]

      Region SortOrder East 2 North 1 South 3 West 4

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

      • #1158816

        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:

        [table=Table for sort]

        Region SortOrder East 2 North 1 South 3 West 4

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

        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

    Viewing 0 reply threads
    Reply To: Custom Sort

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: