Skip to main content

Sort Results

Last updated 8/04/2022

Sort the Returned Result Set

By default your records will be returned in the order they are positioned in your tables in the database. In Five, you can select to have the records in Ascending, Descending, or no order.

Ascending order will return:

  • Lowest to highest for a numeric field.
  • Earliest to latest for a date or time field.
  • A to Z for a text field.

Descending order will return:

  • Highest to lowest for a numeric field.
  • Latest to earliest for a date or time field.
  • Z to A for a text field.

Sort by Ascending Order

Prerequisite

Give your query a title and open the Table and Fields Designer.

Steps

  1. Click the Add Table button.

Add Table Button
Figure 1 - Add Table button

  1. Select a table.

Select a Table
Figure 2 - Select a table

  1. Click outside of the Table Selector dialog box to close the window.

  2. Select the table and drag to the desired position on the Designer.

  3. Double click the field names required for the query.

  4. In the field you want to sort by, click the lookup icon in the Sort field and select Ascending.


Sort by Ascending
Figure 3 - Sort by Ascending


Result Set
Figure 4 - Result set

Sort by Descending Order

Prerequisite

Give your query a title and open the Table and Fields Designer.

Steps

  1. Click the Add Table button.

Add Table Button
Figure 5 - Add Table button

  1. Select a table.

Select a Table
Figure 6 - Select a table

  1. Click outside of the Table Selector dialog box to close the window.

  2. Select the table and drag to the desired position on the Designer.

  3. Double click the field names required for the query.

  4. In the field you want to sort by, click the lookup icon in the Sort field and select Descending.


Sort by Descending
Figure 7 - Sort by Descending


Result Set
Figure 8 - Result set

Sort by Multiple Fields.

At the time of this documentation, CONCAT is not supported in the Table and Fields Designer. The following is a scenario in which you can order by two fields. If we were to sort by the first name and then the last name. Five would first sort by the first field and then the second field.

Example

First NameLast Name
GregAnderson
BethKeely
BethAppleby
BethZenith

If you select to order both the First Name and the Last Name fields in ascending order the results would be:

First NameLast Name
BethAppleby
BethKeely
BethZenith
GregAnderson

Steps

  1. Click the Add Table button.

Add Table Button
Figure 9 - Add Table button

  1. Select a table.

Select a Table
Figure 10 - Select a table

  1. Click outside of the Table Selector dialog box to close the window.

  2. Select the table and drag to the desired position on the Designer.

  3. Double click the field names required for the query.

  4. In first field you want to sort by, click the lookup icon in the Sort field and select Ascending or Descending.

  5. In first field you want to sort by, click the lookup icon in the Sort field and select Ascending or Descending.


Sort by Multiple Fields
Figure 11 - Sort by Multiple Fields


Result Set
Figure 12 - Result set

Remove Ascending/Descending Sorting

  1. Click the lookup icon in the Sort field.

Sort Lookup Icon
Figure 13 - Sort lookup icon

  1. Select None.

Select None
Figure 14 - Select None


tip

Your, query, query fields, and form need to be saved.