DeleteRecordsInSet()

Summary

Deletes all of the records in a selection set from a view.

Syntax

DeleteRecordsInSet(string set_name)

Argument Contents
set_name The name of the selection set

Notes

  • If the deleted records include the current record (e.g., when the input record_handle is null), the view has no current record after the deletion. Aside from this case, DeleteRecordsInSet() does not change the current record.

  • Records cannot be deleted from comma-separated text tables or joined views. Records are marked for deletion in dBASE tables, standard geographic files, fixed-format text tables, and fixed-format binary tables. Records can be deleted from ODBC tables if you have the proper permissions.

  • When a record is marked for deletion, the record is not physically removed from the file. Instead, it will be deleted the next time the file is rewritten. You can rewrite a file by saving a copy with the File-Save As command, deleting the old table files, and renaming the new table files to the old table file name. You can also use the CopyTableFiles(), DeleteTableFiles(), and RenameTableFiles() functions in a GISDK macro.

  • Records that are marked for deletion are ignored by GISDK.

  • See also the notes for GetRecordCount().

Example

folder = RunMacro("G30 Tutorial Folder")
CopyFile(folder + "manheats.dbf", folder + "manheats2.dbf")
view = OpenTable("manheats", "DBASE", {folder + "manheats2.dbf"}, {{"Shared", "True"}})
SetView(view)
american = CreateSet("American")
n = SelectByQuery(american, "Several", "Select * where CUISINE = 'AMERICAN'")
if n > 0 then DeleteRecordsInSet(american)

Error Codes

Error Type Meaning
Error The set name is invalid or the records could not be deleted
NotFound The set does not exist or is empty

See Also

Function Summary
DeleteRecord() Deletes a record from a view
DeleteSet() Deletes a set from the current view