OP Single order by

4D - Documentation   Français   English   German   4D Open for 4D, Command Theme List   4D Open for 4D, Command Alphabetical List   Back   Previous   Next

version 1.5


OP Single order by (connectionID; tableID; fieldID; orderDirection) Longint

ParameterTypeDescription
connectionIDLongintConnection ID with target server
tableIDLongintNumber of the table in the database
fieldIDLongintNumber of the field in the table
orderDirectionStringOrder by direction (">" is ascending)
Function resultLongintError 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 CodeDescription
-9969Invalid field type requested.
-9971Field number is out of range.
-9972Table number is out of range.
10128The 4D Open for 4th Dimension package has not been initialized.
10136The connection does not exist.
10154This command cannot be executed right now.
10155Invalid 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.


4D - Documentation   Français   English   German   4D Open for 4D, Command Theme List   4D Open for 4D, Command Alphabetical List   Back   Previous   Next