The main concepts for programming the memory Table controls are as follows.
Several WLanguage functions allow you to manage this type of control by programming. Do not hesitate to see the documentation about these functions.
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:
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_MyTable..Empty = True THEN TABLE_MyTable.Add()
Adding rows into a memory Table control
Adding rows into a memory Table control is performed:
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 zones
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. ..Modified is set to True.
- by programming:
- with <Table>.Modify to modify the content of the current row or the content of a given row.
TABLE_CUSTOMER.Modify("MOORE" + TAB + "Vince" + TAB + "Miami")
Remark: you can also use the name of the Table control directly:
// Modify the current row
TABLE_CUSTOMER = "MOORE" + TAB +"Vince" + TAB + "Miami"
// Modify row 3
TABLE_DAY.Modify("Wednesday" + TAB + "Off", 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 (subscript).
COL_NAME[Subscript] = EDT_CustomerName
To modify a column of the current row, there is no need to specify the subscript. For example:
COL_NAME = EDT_CustomerName
..Modified is set to False (it is set to True when an input is performed in the Table control).
Forcing the input
can be used to force the input in a column of the current row.
// Entry process in the COL_QTY column
// COL_QTY cannot be entered,
// if COL_PRODUCT is not entered
IF NoSpace(COL_PRODUCT) = "" THEN
Error("The Product column must be entered first")
Adding or deleting a column
Operations on the rows and cells
Deleting a row
The deletion of a row must be explicitly requested by <Table>.Delete
. The following syntax is used:
If the subscript is specified, <Table>.Delete
deletes the image that corresponds to the subscript. Otherwise, the current row is deleted. For example:
A row can be selected with <Table>.SelectPlus
The following syntax is used:
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.
// COL_QTY is a column of the Table control
IF COL_QTY < 10 THEN
Value of a cell in a specific row
To retrieve the value of a column not found on the current row, the row subscript must be specified.
<Value> = <Column name>[<Subscript>]
// Add the total price before tax (PBT) for all the order lines
TotalPrice = 0
FOR Subscript = 1 _TO_ TABLE_ORDERS..Occurrence
TotalPrice = TotalPrice + COL_PBT[Subscript]
Content of current row
To retrieve the content of the current row, use the following syntax:
<Value> = <Table control>
Content of specific row
To retrieve the content of the row whose subscript is <Subscript>, use the following syntax:
<Value> = <Table control>[<Subscript>]
: The subscript of the current row is returned by <Table>.Select
// Retrieve row #10 in the TABLE_CUSTOMER control
CurrentRow = TABLE_CUSTOMER
// Name of selected customer
CustomerName = COL_NAME[TABLE_CUSTOMER.Select()]
// Retrieve the current row in the TABLE_CUSTOMER control
CurrentRow = TABLE_CUSTOMER