ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Controls, pages and windows / Table functions
  • Use conditions
  • Deleting records in a Table or TreeView Table control based on a data file
  • Referential integrity and Table or TreeView Table controls based on a data file
  • Deleting records in a Table control based on a data file and Trigger
  • Handling errors
  • Locking the linked data file
  • Deleting records in a Table control populated programmatically with a "Contains" filter
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Deletes a row from:
  • a Table control,
  • a TreeView Table control,
  • WINDEV a table displayed in a Combo Box control.
WINDEV Note: To delete a line with animation, use the TableDeleteWithAnimation function.
Example
// Suppression de la ligne 5 dans le champ "TABLE_Produit"
TableDelete(TABLE_Produit, 5)
// Supprimer toutes les lignes sélectionnées dans un champ Table
// A partir de la version 18, la fonction TableSupprimeSelect est disponible
i is int
NbSelection is int = TableSelectOccurrence(TABLE_MaTable)
FOR i = NbSelection TO 1 STEP -1
	TableDelete(TABLE_MaTable, TableSelect(TABLE_MaTable, i))
END
Syntax
TableDelete(<Table control> [, <Index>])
<Table control>: Control name
Name of the control to be used. This control can correspond to:
  • a Table control.
  • a TreeView Table control.
  • WINDEV a Combo Box control with table.
If this parameter is an empty string (""), the Table control of the current event will be used.
<Index>: Optional integer
Index of the row to delete.
If this parameter is not specified, the selected rows are deleted. If this parameter is not specified and if no row is selected, TableDelete has no effect.
Remarks

Use conditions

TableDelete can be used on:
  • Table or TreeView Table controls based on a data file.
  • Table or TreeView Table controls populated programmatically.
  • single-selection or multi-selection controls.
    WEBDEV - Server codePHP Reminder: Multi-selection is not available for Table fields in "Server" mode.
WEBDEV - Server codePHP This function is available for Table controls in "Server" and "Server + AJAX" mode, and for TreeView Table controls.
WEBDEV - Browser code This function is available for Table controls in "Browser" mode only.
WEBDEV - Browser code The TreeView Table control is not available.

Deleting records in a Table or TreeView Table control based on a data file

TableDelete deletes the corresponding record from the data file associated with the control. If items are linked to other data files, no modification is automatically performed on these linked data files.

Referential integrity and Table or TreeView Table controls based on a data file

If the management of referential integrity is enabled (HSetIntegrity), HErrorIntegrity must be called after TableDelete to check the integrity.
If an integrity error is detected, the row is not deleted and it remains visible in the control.

Deleting records in a Table control based on a data file and Trigger

You have the ability to activate a trigger when deleting a record from a Table control based on a data file. For more details, see the documentation about HDescribeTrigger.

Handling errors

The ErrorOccurred variable is set to True if the deletion fails. To get the details of the error, use ErrorInfo.
Example of error: Deleting a line whose index corresponds to a non-selected line in the visible part of the Table field.

Locking the linked data file

If the data file is locked in the current process, TableDelete deletes the specified row and unlocks the data file.

Deleting records in a Table control populated programmatically with a "Contains" filter

When used on a Table control populated programmatically with a "Contains" filter, TableDelete displays the records that do not match the filter. The filters defined by the AAFs (Automatic Application Features) are canceled.
Component: wd300obj.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/21/2024

Send a report | Local help