ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / Table functions
  • Characteristics of column elements
  • Position of inserted 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: Inserting several columns
  • Inserting 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
TableInsertColumn (Function)
In french: TableInsèreColonne
Inserts elements in the format of columns into a horizontal Table control.
Caution: This function cannot be used to insert columns into a standard Table control. To dynamically add columns into a standard Table control, use ControlClone.
Syntax
TableInsertColumn(<Table control> [, <Index> [, <Element column 1> [... [, <Element column N>]]]])
<Table control>: Control name
Name of the Horizontal Table control to be used.
If this parameter corresponds to an empty string (""), the Table control used will be the one to which the current event belongs.
<Index>: Optional integer
Index of the column into which the elements will be inserted. The index of the first column is set to 1.
Index not specifiedThe column is inserted before the current column. If no column is selected, the column is inserted at the end of the Table control.
Index greater than the number of columns in the Table controlThe column is inserted at the end of Table control.
Index equal to 0The column is inserted at the beginning of Table control.
Index equal to -1The column is inserted before the current column.
<Element column 1>: Type of associated column (optional)
First column element that will be inserted into the specified Table control. Each element corresponds to a row in the Table control. The type of the inserted 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 browsing Table control, the default values defined in the linked file are taken into account.
<Element column N>: Type of associated column (optional)
Nth column element that must be inserted into the specified Table control. Each element corresponds to a row in the Table control. The type of the inserted 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 file are taken into account.
Remarks

Characteristics of column elements

  • To specify no value for one of the elements, 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:
    TableInsertColumn(TABLE_CalcTable, 3, (53+29), (83-21))

Position of inserted column

By default, the column is inserted at the specified position.
  • If the Table control is sorted with TableSort, the new column is positioned according to the current sort and not to the specified index.
  • If the Table control is sorted by the user, the sort is ignored when the column is inserted. The column is inserted at the specified position.

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 advise you to use Table controls with an important number of rows 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 browsing 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 record into the data file, TableSave must be run after TableInsertColumn.
Reminder: The "cascading input" option can be selected:
  • When creating a Table control.
  • In the "Details" tab of the description window of Table control in the window editor.

Table control based on a data file: Inserting several columns

A virtual column is created each time TableInsertColumn 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 TableInsertColumn 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.

Inserting an image

To insert an image into a Table control, specify the name and full path of the image to insert.
For example:
TableInsertColumn(TABLE_MyTable, 5, "C:\MyDocuments\MyImage.BMP")
Remark: The row must be an Image type row otherwise the inserted image will not be displayed properly.

Table control in edit mode

If TableInsertColumn is called:
  • In a control event, the cursor is automatically positioned on the first row to edit in the inserted column.
  • In an event that does not belong to the control, (or in another process) SetFocusAndReturnToUserInput must be used to resume the input in the Table control.
Component: wd300obj.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