|
|
|
|
|
- Overview
- Selecting, adding and modifying a row in a Table control based on a data file
- Deleting a row from a Table control based on a data file
- Managing calculated columns
- Retrieving the content of a row, column or cell
- Important
- Value of the cell in the current row
- Value of a cell in a specific row
- Content of the current row
- Content of row X
- Content of the selected rows for a multiple selection
Programming Table controls based on a data file
This page explains how to program Table controls based on a data file. There are multiple WLanguage functions to programmatically manipulate this type of Table controls. Selecting, adding and modifying a row in a Table control based on a data file A row can be selected with TableSelectPlus. If no stored item is defined for the Table control, you can use the following syntax: <Champ Table> = <Numéro de la ligne à sélectionner> Deleting a row from a Table control based on a data file To delete a row from the Table control based on a data file, use TableDelete. TableDelete deletes the corresponding record from the data file.
Important: To delete a record in the data file, do not use the HDelete function, otherwise data in the data file will be lost. Managing calculated columns The calculation formula of a calculated column must be defined in the "Display a row" event of a Table control. Example of code in the "Display a row" event of the Table control:
IF COL_Stock < 200 THEN
COL_MsgAlerte = "Alerte"
ELSE
COL_MsgAlerte = ""
END
By definition, a Calculated control is not linked to a field: the value assigned by a line's display code is not memorized after scrolling through the lines of the Table field using the vertical scrollbar.. For example, a "FOR EACH LINE" statement cannot be used to assign or retrieve the value of a calculated column for all the rows of the Table control. If the Table control uses an in-memory data source ("Loaded in memory" option checked in the "Content" tab of the control description window), the value in the calculated columns will not be lost at runtime. Retrieving the content of a row, column or cell Important The content of a row in a Table control based on a data file can be retrieved: - by retrieving the entire row.
- cell by cell.
Value of the cell in the current row The cell is identified by the name of the column. The following syntax must be used: <Valeur> = <Nom de la colonne> Example:
IF COL_QTE < 10 THEN
Info("Quantité insuffisante")
END
Value of a cell in a specific row The cell is identified by the name of the column. The following syntax must be used: <Valeur> = <Nom de la colonne>[<Indice de la ligne>] Example:
PrixTotal = 0
FOR Indice = 1 TO TABLE_COMMANDE.Occurrence
PrixTotal = PrixTotal + COL_PHT[Indice]
END
Content of the current row The following syntax must be used: You also have the ability to use the following syntax: <Valeur> = <Champ Table>[<Champ Table>] Content of row X The following syntax must be used: <Valeur> = <Champ Table>[<Indice de la ligne>] Remark: The line index can be given by the TableSelect function..
LigneEnCours = TABLE_CLIENT
NomCli = COL_NOM[TableSelect(TABLE_CLIENT)]
Content of the selected rows for a multiple selection The following syntax must be used: <Valeur> = <Champ Table>[<Indice de la ligne>] Remark: To find out the indices of the selected lines, use functions TableSelectCount and TableSelect..
i is int
NbSelectionne is int = TableSelectOccurrence(TABLE_Produit)
FOR i = 1 TO NbSelectionne
Trace("Ligne sélectionnée: " + ...
TABLE_Produit[TableSelect(TABLE_Produit, i)])
END
Note: Table based on a data file fields are not available: - If the Table control contains proportional scrollbars.
- If the Table control is "5.5 compatible".
- In Table controls displayed by Combo Boxes.
Remark: The Multiselection property indicates the selection mode of a Table field.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|