PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Overview
  • Initializing a memory Table control
  • Adding rows into a memory Table control
  • Managing calculated columns
  • Modifying a row or a column
  • Forcing the input
  • Adding or deleting a column
  • Operations on the rows and cells
  • Deleting a row
  • Retrieving the row content or the cell content
  • Value of a cell in the current row
  • Value of a cell in a specific row
  • Content of current row
  • Content of specific row
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
Overview
The main concepts for programming the memory Table controls are as follows.
Several WLanguage functions allow you to manage this type of control through programming. Do not hesitate to see the documentation about these functions.
For more details, see Table control management functions.
Versions 20 and later
Android The Table control is now available for Android applications.
iPhone/iPad The Table control is now available for iPhone/iPad applications.
New in version 20
Android The Table control is now available for Android applications.
iPhone/iPad The Table control is now available for iPhone/iPad applications.
Android The Table control is now available for Android applications.
iPhone/iPad The Table control is now available for iPhone/iPad applications.
Initializing a memory Table control
The creation of a row in a Table control is not automatically performed. It must be explicitly requested via a call to:
Remark: if "Cascading input (Addition)" is not selected:
  • A Table control contains no row when it is created:
    TABLE_MaTable.Occurrence = 0.
    In this case, no input is allowed and Empty is set to True.
  • To automatically insert a row if the Table control is empty, the following command lines must be used in the event "Initializing" of the Table control:
    IF TABLE_MaTable.Vide = True THEN TableAdd(TABLE_MaTable)
Adding rows into a memory Table control
Adding rows into a memory Table control is performed:
WINDEVWEBDEV - Server codeJavaPHP If a new row was added into the Table control by TableAdd, TableInsert, TableAddLine or TableInsertLine, New is set to True (otherwise, it is set to False).
Managing calculated columns
The calculation formula of a calculated column must be described in the event "Displaying a table row" of a Table control. For example:
// COL_PBT: calculated column
// COL_UPBT and COL_QTY: columns linked to memory areas
COL_PBT = COL_UPBT * COL_QTY
Modifying a row or a column
The content of a Table control's rows or columns can be modified:
  • by the user, by performing an input in the columns. The modifications are automatically stored in the Table control with no additional programming. The Modified property is set to True.
  • through programming:
    • with TableModify to modify the content of the current row or the content of a given row.
      For example:
      TableModify(TABLE_CLIENT, "PY" + TAB + "Jean" + TAB + "Nîmes")

      Remark: you can also use the name of the Table control directly:
      // Modifier la ligne en cours
      TABLE_CLIENT = "DURAND" + TAB +"Sophie" + TAB + "Nîmes"
      // Modifier la ligne 3
      TableModify(TABLE_JOUR, "Mercredi" + TAB + "Vaqué", 3)
    • by specifying the column name (like for an edit control) to modify the column content. To modify a column of a specific row, the row number must be specified (index).
      For example:
      COL_NOM[Indice] = SAI_NomClient

      To modify a column of the current row, there is no need to specify the index. For example:
      COL_NOM = SAI_NomClient

      The Property Modified is at False (it is only set to True by an entry in the Table control).
WINDEVWindowsJavaUser code (UMC)

Forcing the input

The SetFocusAndReturnToUserInput function can be used to move back to a column in the current row.
For example:
// Traitement d'entrée colonne COL_QTE
// COL_QTE ne peut pas être saisi,
// si COL_PRODUIT n'est pas saisi
IF NoSpace(COL_PRODUIT) = "" THEN
Error("La colonne Produit doit être saisie en premier")
SetFocusAndReturnToUserInput(COL_PRODUIT)
END
WINDEVWEBDEV - Server codeWindowsJavaUser code (UMC)

Adding or deleting a column

It is possible to:
Operations on the rows and cells

Deleting a row

The deletion of a row must be explicitly requested by TableDelete. The following syntax is used:
TableSupprime(<Champ Table>[, <Indice>])
S If the subscript is specified, the TableDelete function deletes the row corresponding to the subscript. Otherwise, the current row is deleted. For example:
TableDelete(TABLE_CLIENT)
The deletion of a Table control row also deletes all the values of the columns for this row.
A row can be selected with TableSelectPlus.
The following syntax is used:
TableSelectPlus(<Champ Table>[, <Indice>])

Retrieving the row content or the cell content

The content of a memory Table control can be retrieved:
  • for the entire row.
  • cell by cell.

Value of a cell in the current row

To retrieve the value of a column (or cell) for the current row, the syntax is the same as for a simple edit control.
<Valeur> = <Nom Colonne>
Example:
// COL_QTE est une colonne du champ Table
IF COL_QTE < 10 THEN
Info("Qté insuffisante")
END

Value of a cell in a specific row

To retrieve the value of a column not found on the current row, the row index must be specified.
<Valeur> = <Nom Colonne>[<Indice>]
For example:
// Totaliser le Prix PHT pour toutes les lignes de commande
PrixTotal = 0
FOR Indice = 1 _TO_ TABLE_COMMANDE.Occurrence
PrixTotal = PrixTotal + COL_PHT[Indice]
END

Content of current row

To retrieve the content of the current row, use the following syntax:
<Valeur> = <Champ Table>

Content of specific row

To retrieve the content of the row whose subscript is <Subscript>, use the following syntax:
<Valeur> = <Champ Table>[<Indice>]
Remark: The index of the current row is returned by TableSelect.
For example:
// Récupérer la ligne 10 dans le champ Table TABLE_CLIENT
LigneEnCours = TABLE_CLIENT[10]
 
// Nom du client sélectionné
NomClient = COL_NOM[TableSelect(TABLE_CLIENT)]
 
// Récupérer la ligne en cours dans le champ Table TABLE_CLIENT
LigneEnCours = TABLE_CLIENT
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment