version 1.5
OP Delete selection (connectionID; tableID) Longint
Parameter | Type | Description | |
connectionID | Longint | Connection ID with target server | |
tableID | Longint | Number of the table in the database | |
Function result | Longint | Error code result for the function |
Description
OP Delete selection deletes all the records of the current selection of tableID. If there are no records in the current selection, this function has no effect.
Error Codes
If OP Delete selection executes successfully, it returns 0. Otherwise, this function returns one of the following errors:
Error Code | Description |
-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. |
Example
This example selects, archives and deletes all invoices from three years ago.
C_LONGINT(vRecords; $ErrCode) C_STRING (50;vValue) C_LONGINT(vTable;vFieldDate) $errCode:=OP Get one field number (vConnectID;"[Invoices]Invoice date";vTable;vFieldDate) ` Compute 31st of December of three years ago vValue:="12/31/" + String ( Year of ( Current date ) -3 ;"####") ` Query for that year's invoices $errCode:=OP Single query (vConnectID;vTable;vFieldDate;"<=";->vValue;vRecords) ArchiveInvoices ` Now we can delete the old invices $errCode:=OP Delete selection (vConnectId;vTable)
See Also
DELETE SELECTION, OP All records, OP Records in selection, OP Single query.