PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Use conditions
  • Updating the data file linked to the Table or TreeView Table control
  • Cascading input and update of linked data file
  • Re-displaying the row that was saved
  • Locking and updating the data file
  • Duplicates and referential integrity
  • Use <Table>.Save to reduce the number of lines of code
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Modifies or adds the record associated with the current row in the browsing Table or browsing TreeView Table control. The record is updated:
  • in the data file linked to the control.
  • Versions 20 and later
    WINDEV in the object linked to the control.
    New in version 20
    WINDEV in the object linked to the control.
    WINDEV in the object linked to the control.
Versions 16 and later
WINDEVLinux This function is now available for WINDEV applications in Linux.
New in version 16
WINDEVLinux This function is now available for WINDEV applications in Linux.
WINDEVLinux This function is now available for WINDEV applications in Linux.
Example
// Enregistrement des données de la ligne en cours
// pour le champ Table "TABLE_Produit"
TABLE_Produit.Enregistre()
// Enregistrement des données de la ligne 5
// avec modification d'une colonne par programmation
TABLE_Produit = 5
TABLE_Produit[5].COL_Lib = "nouvelle valeur"
TABLE_Produit.Enregistre()
Versions 20 and later
// Evénement Sortie d'une ligne
SI TABLE_Client.Modifié = Faux ALORS
RETOUR
FIN
pclPresentationFiche est un PFicheClient dynamique
SI TABLE_Client.Nouveau ALORS
pclPresentationFiche<-gclPresentation.Nouveau()
SINON
pclPresentationFiche<-gclPresentation.Modifier()
FIN
TABLE_Client.Enregistre(pclPresentationFiche)
New in version 20
// Evénement Sortie d'une ligne
SI TABLE_Client.Modifié = Faux ALORS
RETOUR
FIN
pclPresentationFiche est un PFicheClient dynamique
SI TABLE_Client.Nouveau ALORS
pclPresentationFiche<-gclPresentation.Nouveau()
SINON
pclPresentationFiche<-gclPresentation.Modifier()
FIN
TABLE_Client.Enregistre(pclPresentationFiche)
// Evénement Sortie d'une ligne
SI TABLE_Client.Modifié = Faux ALORS
RETOUR
FIN
pclPresentationFiche est un PFicheClient dynamique
SI TABLE_Client.Nouveau ALORS
pclPresentationFiche<-gclPresentation.Nouveau()
SINON
pclPresentationFiche<-gclPresentation.Modifier()
FIN
TABLE_Client.Enregistre(pclPresentationFiche)
Syntax

Saving in a data file Hide the details

<Table control>.Save()
<Table control>: Control name
Name of browsing Table control to use.
WINDEV

Saving in an object (syntax mainly available for the MVP) Hide the details

<Table control>.Save(<Object name>)
<Table control>: Control name
Name of Table control on variable to use.
<Object name>: Character string
Name of object to use. The content of the current row found in the Table control will be saved in the members of the associated object.
Remarks

Use conditions

<Table>.Save can be used on:
  • a browsing Table control or a browsing TreeView Table control.
  • a single-selection or multi-selection control. For a multi-selection control, only the last selected record is modified (the record corresponding to the last current row).
  • Versions 20 and later
    WINDEV a Table control on variable (syntax 2).
    New in version 20
    WINDEV a Table control on variable (syntax 2).
    WINDEV a Table control on variable (syntax 2).

Updating the data file linked to the Table or TreeView Table control

<Table>.Save saves the current control row in the data file linked to the control. The items are automatically assigned with the values of associated columns in the current row.
When a modification is performed, <Table>.Save replaces the former values by the new ones. The items not found in the control are not modified.
Caution:
  • <Table>.Save only manages the data file associated with the control. If some columns are linked to items found in other data files, these data files are not automatically managed.
  • The "image" columns are not saved by <Table>.Save. To modify the content of the memo associated with the image (rare case), use HLinkMemo.
  • In the Check Box columns, the call to <Table>.Save is implicit and it cannot be disabled. In any case, the modification of the value of check box will be applied to the data file.

Cascading input and update of linked data file

  • If the cascading input is enabled, the data file linked to the Table or TreeView Table control is automatically modified when the user goes to the next row (use of <Table>.Add, <Table>.AddLine, <Table>.Insert, <Table>.InsertLine, <Table>.Modify and <Table>.ModifyLine). <Table>.Save is useless.
  • If the cascading input is not enabled, the data file linked to the Table or TreeView Table control is not modified. To write the added or modified row into the linked data file, <Table>.Save must be used after the addition or modification function.
Remarks:
Java The cascading input is not available for browsing Table controls with direct access. This option is available for the browsing Table controls loaded in memory.

Re-displaying the row that was saved

After the call to <Table>.Save, the row saved may "disappear". This "disappearance" is due to the value of the search key for the added or modified record.
To avoid this problem, re-display the Table or TreeView Table control with <Table>.Display.

Locking and updating the data file

If the data file is locked in the current process, <Table>.Save saves the current row and unlocks the data file.

Duplicates and referential integrity

  • If the management of duplicates is enabled (HSetDuplicates), HErrorDuplicates must be checked after the execution of <Table>.Save to check the key uniqueness.
  • If the management of referential integrity is enabled (HSetIntegrity), HErrorIntegrity must be checked after the execution of <Table>.Save to check the referential integrity.

Use <Table>.Save to reduce the number of lines of code

<Table>.Save reduces several lines of code. This single line allows you to avoid assigning the item variables one by one.
For example, the following code:
Client.Nom = ColonneNom
Client.Prénom = ColonnePrénom
Client.Adresse = ColonneAdresse
Client.CP = ColonneCP
Client.Ville = ColonneVille
HAjoute(Client)
is replaced with the following line:
TABLE_Client.Enregistre()
Component: wd270obj.dll
Minimum version required
  • Version 23
This page is also available for…
Comments
Click [Add] to post a comment