CreateSortCondition(sortOrder)
Returns the FieldSortCondition object, which is a sort condition of query records by a specified query field. The field must belong to the Query::Fields collection. To specify a sort condition for a query, the object must be placed into the Query::FieldSortConditions collection. It is impossible to add the FieldSortCondition object to the Query::FieldSortConditions collection if a query is based on an SQL statement SELECT.
For queries of external databases, hidden fields (the Field::Visible property returns False) and fields overridden by calculated fields (the Field::HasCalcFields property returns True) may be specified in a sort condition, but sorting by these fields is not performed.
For queries of external databases, a reference table set for the field is not considered while sorting records what means that direct values of the field are sorted.
The sortOrder argument specifies the sort order for the field. The sort order is specified by one of the constants given in the "Sort order" table.