version 2003
PA_DeleteSelection (tableNum)
Parameter | Type | Description | |
tableNum | short | Table number |
Description
The command PA_DeleteSelection deletes all the records in the selection for the table number tableNum.
Before attempting to delete record(s), the 4D plug-in must make sure it has access to the table in read-write mode for the current process, by calling PA_UseSet. Otherwise the records will not be deleted.
While deleting the records, PA_DeleteSelection may encounter records already being used by an other user or process. In this case the locked records are left untouched and are automatically placed into the set "LockedSet" by 4th Dimension. After the call it is the 4D plug-in's responsibility to test this set using PA_UseSet. Usually the 4D plug-in would implement a repeat loop of calls to PA_DeleteSelection until the selection returned by PA_UseSet is empty.
WARNING
This routine does not use virtual structure
Example
Loop until the selection is deleted.
void MyDeleteSelection (short tableNum) { long lockedCount; // Loop do { PA_Yield(); // Give time to other tasks lockedCount = 0L; // Delete the selection PA_DeleteSelection(tableNum); // If no error, test the "LockedSet" if(! PA_GetLastErr()) { PA_UseSet(tableNum;"LockedSet"); if(! PA_GetLastErr()) lockedCount = PA_RecordsInSelection(tableNum); } // loop until an error occurs or the selection is empty } while( (PA_GetLastErr() == eER_NoErr) && (lockedCount != 0L) ) }
See Also
Error Handling
Use PA_GetLastError to see if an error occurred
Current Selections and Records
After deleting the selection, it is empty.