OP Delete selection

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 Delete selection (connectionID; tableID) Longint

ParameterTypeDescription
connectionIDLongintConnection ID with target server
tableIDLongintNumber of the table in the database
Function resultLongintError 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 CodeDescription
-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.

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.


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