PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • 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
  • Selecting the row
  • Retrieving the content of a row or the content of a cell
  • Value of a cell in the current row
  • Value of a cell in a specific row
  • Content of current row
  • Content of a specific row
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
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 by programming. Do not hesitate to see the documentation about these functions.
Versions 20 and later
Android The Table control is now available for the Android applications.
iPhone/iPad The Table control is now available for the iPhone/iPad applications.
New in version 20
Android The Table control is now available for the Android applications.
iPhone/iPad The Table control is now available for the iPhone/iPad applications.
Android The Table control is now available for the Android applications.
iPhone/iPad The Table control is now available for the 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:
Note: if the cascading input is not selected:
  • A Table control contains no row when it is created: TABLE_MyTable..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 initialization process of the Table control:
    IF TABLE_MyTable..Empty = True THEN TableAdd(TABLE_MyTable)
Adding rows into a memory Table control
Adding rows into a memory Table control is performed:
WINDEVWEBDEV - Server codeWindows MobileJavaPHP If a new row was added into the Table control by TableAdd, TableInsert, TableAddLine or TableInsertLine, ..NewLine 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 "Displaying a table row" process. 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 TableModify to modify the content of the current row or the content of a given row.
      For example:
      TableModify(TABLE_CUSTOMER, "MOORE" + TAB + "Vince" + TAB + "Miami")

      Note: 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
      TableModify(TABLE_DAY, "Wednesday" + TAB + "Off", 3)
    • by specifying the name of the column (like for an edit control) to modify the content of the column. To modify a column of a specific row, the number of the row must be specified (subscript).
      For example:
      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).
WINDEVWindowsWindows MobileJavaUser code (UMC)

Forcing the input

ReturnToCapture can be used to force the input in a column of the current row.
For example:
// 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")
ReturnToCapture(COL_PRODUCT)
END
WINDEVWEBDEV - Server codeWindowsWindows MobileJavaUser code (UMC)

Adding or deleting a column

You can:
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:
TableDelete(<Name of Table Control> [, <Subscript>])
If the subscript is specified, TableDelete deletes the row corresponding to the subscript. Otherwise, the current row is deleted. For example:
TableDelete(TABLE_CUSTOMER)
The deletion of a Table control row also deletes all the values of the columns for this row.

Selecting the row

The selection of a row is performed by TableSelectPlus.
The following syntax is used:
TableSelectPlus(<Name of Table Control>[, <Subscript>])

Retrieving the content of a row or the content of a cell

The content of a memory table 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.
<Value> = <Column_Name>
Example:
// COL_QTY is a column of the Table control
IF COL_QTY < 10 THEN
Info("Insufficient quantity")
END

Value of a cell in a specific row

To retrieve the value of a column not found on the current row, the subscript of the row must be specified.
<Value> = <Column_Name>[<Subscript>]
For example:
// 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]
END

Content of current row

To retrieve the content of the current row, use the following syntax:
<Value> = <TableName>

Content of a specific row

To retrieve the content of the row whose subscript is <Subscript>, use the following syntax:
<Value> = <Table_Name>[<Subscript>]
Note: The subscript of the current row is returned by TableSelect. For example:
// Retrieve row #10 in the TABLE_CUSTOMER control
CurrentRow = TABLE_CUSTOMER[10]

// Name of selected customer
CustomerName = COL_NAME[TableSelect(TABLE_CUSTOMER)]

// Retrieve the current row in the TABLE_CUSTOMER control
CurrentRow = TABLE_CUSTOMER
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment