This page explains how to sort on data columns.
Topics on this page:
- Sort data by a given column
- Clear sorts
- Advanced: Understand Sorting URLs
Sort Data in a Column
To sort data displayed in a grid view, click on the column name. If the column is sortable (and most columns you will encounter in grids are sortable), the sort/filter popup menu will appear. The following screen shot shows the Physical Exam
data grid. The Temperature
column has been clicked to bring up sort options:
Choose Sort Ascending
or Sort Descending
to sort the dataset based on the contents of the chosen column.
Once you have sorted your dataset using a particular column, a triangle icon
) will appear in the column header. If the column's sort is ascending, the triangle points up. If the column's sort is descending, the triangle points down.
By default, LabKey sorting is case-sensitive. If your LabKey installation is running against Microsoft SQL Server, however, sorting is case-insensitive. If you're not sure which database your LabKey installation is running against, ask your system administrator.
To remove a sort on an individual column, click the column caption and select Clear Sort
Advanced: Understand Sorting URLs
You can sort a grid view using multiple columns at a time, which follows these rules:
- The grid view is sorted by the most recently clicked column first.
The sort specifications are included on the page URL. You can modify the URL directly to change the sorted columns, the order in which they are sorted, and the direction of the sort. For example, the following URL sorts the Physical Exam grid first by ascending ParticipantId, and then by descending Temp_C:https://www.labkey.org/study/home/Study/demo/dataset.view?datasetId=5004&Dataset.sort=ParticipantId%2C-Temp_C
Note that the minus ('-') sign in front of the Temp_C
column indicates that the sort on that column is performed in descending order. No sign is required for an ascending sort, but it is acceptable to explicitly specify the plus ('+') sign.
hexadecimal code that separates the column names represents the URL encoding symbol for a comma.