By default, find results are sorted by the entity's ID field is ascending order. However, in some cases, sorting by ID may not be appropriate. For example, it may make more sense to sort Companies record by the name of the Company. Therefore, Aptify allows an administrator to modify the sort order of find results when applicable.
Concerning Sub-Type Entities
This attribute is not applicable to sub-type entities.
This behavior is controlled by the FindOrderBySQL field which can be added to the Configuration -> Attributes tab of any Entities record. An administrator can define an unlimited number of sort order levels for a particular entity by modifying the sort criteria with the FindOrderBySQL attribute using the steps below:
- Open or create a view within the Entities service.
- Open the entity that you want to configure.
- Select the Configuration tab.
- Select the Attributes sub-tab.
- Click the New icon to create a new Entity Attributes record.
- Enter FindOrderBySQL in the Name field.
- In the Value field, define the sort criterion, separated by a comma, using the syntax below:
- First Level Field Name to Sort By DIRECTION(ASC|DESC), Second Level Field Name to Sort By DIRECTION(ASC|DESC), etc.
- In the example below, the FindOrderBySQL has been added to the Persons entity. With these settings, the results returned when running a search for records in the Persons service are first sorted in ascending order by Last Name record and then in descending order by Title.
- Click OK and Save and Close the entity record.