ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / Table functions
  • Characteristics of column elements
  • Position of added column
  • Limitations: Maximum number of displayed columns
  • Table control based on a data file: Modifications in the linked data file
  • Table control based on a data file: Adding several columns
  • Adding records to a Table control based on a data file and Trigger
  • Adding an image
  • Table control in edit mode
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
TableAddColumn (Function)
In french: TableAjouteColonne
Adds elements on the right of an Horizontal Table control.
Caution: This function cannot be used to add columns into a standard Table control (vertical Table control). To dynamically add columns into a standard Table control, use ControlClone.
Syntax
<Result> = TableAddColumn(<Table control> [, <Element row 1> [... [, <Element row N>]]])
<Result>: Integer
  • Index of the new column,
  • -1 if an error occurred.
<Table control>: Control name
Name of the Horizontal Table control to be used.
If this parameter corresponds to an empty string (""), the Table control to which the current process belongs will be used.
<Element row 1>: Type of associated row (optional)
Elements of column to add to the specified Table control. Each element corresponds to a row. The type of the added element must be compatible with the type of the relevant row.
If none of these parameters is specified, an empty column is added to the Table control. For a Table control based on a data file, the default values defined in the linked data file are taken into account.
<Element row N>: Type of associated column (optional)
Elements of column to add to the specified Table control. Each element corresponds to a row. The type of the added element must be compatible with the type of the relevant row.
If none of these parameters is specified, an empty column is added to the Table control. For a Table control based on a data file, the default values defined in the linked data file are taken into account.
Remarks

Characteristics of column elements

  • To specify no value for an element, use an empty string ("") or 0 (according to the type of the row).
  • If an element corresponds to the calculation result, the numeric expression must be enclosed in brackets. For example:
    TableAddColumn(TABLE_CalcTable, (53+29), (83-21))

Position of added column

By default, the column is added at the end of the Table control.
  • If the Table control is sorted by TableSort, the added column is positioned in the control according to the current sort.
  • If the Table control is sorted by the user, the sort is ignored when the column is added. The column is added at the end of the control.

Limitations: Maximum number of displayed columns

The maximum number of columns that can be displayed in a Table control is limited by the amount of available memory (theoretical maximum: 2 billion columns).
However, we do not recommend using Table controls with a large number of columns for performance reasons (time required to fill the control for example) and for user-friendliness.

Table control based on a data file: Modifications in the linked data file

If the cascading input is enabled, the data file linked to the Table control is automatically modified when the user goes to the next column.
If the cascading input is not enabled, the data file linked to the Table control based on a data file is not modified. To write the added column into the linked data file, TableSave must be used after TableAddColumn.
Reminder: The option "Cascading input (Add)" can be selected:
  • When creating a Table control.
  • In the "Details" tab of the control description.

Table control based on a data file: Adding several columns

A virtual column is created each time TableAddColumn is called in a Table control based on a data file. The information will be saved in the data file during the call to TableSave.
If TableAddColumn is successively called in the same process without being followed by TableSave, only the FIRST call is effective (the following calls are ignored). Only one column is added to the Table control based on a data file.

Adding records to a Table control based on a data file and Trigger

A trigger can be released when a record is added in a Table control based on a data file. For more details, see the documentation about HDescribeTrigger.

Adding an image

To add an image into a Table control, specify the name and full path of image to add.
For example:
TableAddColumn(TABLE_MyTable, "C:\MyDocuments\MyImage.BMP")

Remark: The row must be an Image row otherwise the image will not be displayed properly.

Table control in edit mode

If TableAddColumn is called:
  • In an event of the Table control, the cursor is automatically positioned on the first row to edit in the added column.
  • In an event that does not belong to the Table control (or in a custom process), SetFocusAndReturnToUserInput must be used to resume the input in the Table control.
Component: wd290obj.dll
Minimum version required
  • Version 12
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help