version 1.5
OP Single order by (connectionID; tableID; fieldID; orderDirection) Longint
Parameter | Type | Description | |
connectionID | Longint | Connection ID with target server | |
tableID | Longint | Number of the table in the database | |
fieldID | Longint | Number of the field in the table | |
orderDirection | String | Order by direction (">" is ascending) | |
Function result | Longint | Error code result for the function |
Description
OP Single order by orders the tableID table's current selection by the values in the field specified by fieldID.
You specify the sorting order by passing either ">" (for ascending order) or "<" (for descending order) to orderDirection.
If the field on which you are ordering is indexed, 4D Server uses that index.
Error Codes
If OP Single order by executes successfully, it returns 0. Otherwise, this function returns one of the following errors:
Error Code | Description |
-9969 | Invalid field type requested. |
-9971 | Field number is out of range. |
-9972 | Table number is out of range. |
10128 | The 4D Open for 4th Dimension package has not been initialized. |
10136 | The connection does not exist. |
10154 | This command cannot be executed right now. |
10155 | Invalid sorting order. |
Example
This example orders the current selection of invoices by date in ascending order:
C_LONGINT (vTable;vField) C_LONGINT($errCode) $errcode:=OP Get one field number (vDonnectID;"[Invoices]Invoice date";vTable;vField) $ErrCode:=OP Single order by (ConnectID;vTable;vField;">")
See Also
OP Get one field number, OP Multi order by, OP Multi query, OP Single query, ORDER BY.