PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Selecting, adding and modifying a row in a Table control
  • Deleting a row from a Browsing Table control
  • Managing calculated columns
  • Retrieving the content of a row, column or cell
  • Important
  • Value of a cell in the current row
  • Value of a cell in a specific row
  • Content of current row
  • Content of row X
  • Content of the selected rows for a multi-selection
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 browsing Table controls are as follows. Several WLanguage functions allow you to manage Browsing Table controls by programming.
Do not hesitate to see the documentation about these functions. For more details, see: List of functions for managing the Table controls.
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.
Selecting, adding and modifying a row in a Table control
The selection of a row is performed by TableSelectPlus.
If no stored item is defined for the Table control, you also have the ability to use the following syntax:
<Table Name> = <Number of Row to Select>
Adding and modifying a row in the Table control (and a record in the file) is performed in two steps:
  1. Adding or modifying the record in the file (via a form window or page for example)
  2. Redisplaying the Browsing Table control:
    • WINDEVAndroidiPhone/iPadWindows Mobile refreshing the Table control.
    • WEBDEV - Server code refreshing the page.
Deleting a row from a Browsing Table control
To delete a row from the Table control, use TableDelete. TableDelete deletes the corresponding record from the data file.
WEBDEV - Server code In WEBDEV, the page must be redisplayed thereafter.
Important: To delete a record from the data file, don't use HDelete otherwise you may lose data.
Managing calculated columns
The calculation formula of a calculated column must be described in the "Displaying a table row" process.
Example of "Displaying a table row" process:
// COL_AlertMsg: a calculated column
// The COL_AlertMsg column displays "Alert" if COL_Stock<200
IF COL_Stock < 200 THEN
COL_AlertMsg = "Alert"
ELSE
COL_AlertMsg = ""
END
By definition, a calculated column is not linked to an item: the value assigned by the display code of a row is not stored after a scroll.
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 is a memory Table control ("Loaded in memory" checked in the "Content" tab of the description window of the control), the calculated columns can be stored at run time.
Retrieving the content of a row, column or cell

Important

The content of a row found in a browsing Table control can be retrieved:
  • by retrieving the entire row.
  • cell by cell.

Value of a cell in the current row

The cell is identified by the name of the column. The following syntax must be used:
<Value> = <Column Name>
// 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

The cell is identified by the name of the column. The following syntax must be used:
<Value> = <Column Name>[<Row Subscript>]
Example:
// Adds the price found in the COL_PBT column  
// for all the order lines displayed
TotalPrice = 0
FOR Subscript = 1 TO TABLE_ORDERS..Occurrence
TotalPrice = TotalPrice + COL_PBT[Subscript]
END

Content of current row

The following syntax must be used:
<Value> = <Name of Table Control>
You also have the ability to use the following syntax:
<Value> = <Name of Table Control>[Name of Table Control>]

Content of row X

The following syntax must be used:
<Value>=<Name of Table Control>[<Row Subscript>]
Note: The row subscript can be returned by TableSelect.
// Retrieves the current row of TABLE_CUSTOMER control
CurrentRow = TABLE_CUSTOMER

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

Content of the selected rows for a multi-selection

The following syntax must be used:
<Value>=<Name of Table Control>[<Row Subscript>]
Note: To find out the subscript of selected rows, you must use TableSelectCount and TableSelect.
// Traces the content of selected rows
i is int
NbSelected is int = TableSelectCount(TABLE_Product)
FOR i = 1 TO NbSelected
Trace("Selected row: " + ...
TABLE_Product[TableSelect(TABLE_Product,i)])
END

// Equivalent to:
// FOR EACH SELECTED ROW OF TABLE_Product
// Trace("Selected row: " + ...
// TABLE_Product[TableSelect(Product,i)])
// END
Note: The multi-selection browsing Table controls are not available:
  • If the Table control contains proportional scrollbars.
  • If the Table control is a "5.5 compatible" type control.
  • In the Table controls displayed by the combo boxes.
Note: ..Multiselection is used to find out the selection mode of a Table control.
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment