ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / Table functions
  • Use conditions
  • Equivalence <Table>.Select
  • Value of the selected element
  • Selection at cell level
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Returns the index of the selected element in the Table or TreeView Table control. This index can correspond to:
  • the number of the selected row. The selected row corresponds to the current row on which the selection bar is displayed.
  • the number of the selected column if the control allows the selection mode by column. This option can be configured in the "UI" tab of the control description.
  • the number of the selected cell if the controls allows the selection mode by cell. This option can be configured in the "UI" tab of the control description.
  • the column number of the selected cell if the controls allows the selection mode by cell. This option can be configured in the "UI" tab of the control description.
Example
// Indice de la ligne sélectionnée dans le champ "TABLE_Produit"
ResSelect = TABLE_Produit.Select()
// Lignes sélectionnées dans un champ Table par programmation multisélection
FOR i = 1 _TO_ TABLE_TABLE1.SelectOccurrence()
	Trace("Elément sélectionné: " + TABLE_TABLE1.Select(i))
END

// Équivalent à:
// i est un entier
// POUR TOUTE LIGNE SELECTIONNEE i DE TABLE_TABLE1
//	 Trace("Elément sélectionné: " + TABLE_TABLE1.Select(i-1))
// FIN
// Supprimer toutes les lignes sélectionnées dans un champ Table
// Il est également possible d'utiliser la fonction <Table>.SupprimeSelect
i is int
NbSelection is int 
NbSelection = TABLE_MaTable.SelectOccurrence()
FOR i = NbSelection TO 1 STEP -1
	TABLE_MaTable.Supprime(TABLE_MaTable.Select(i))
END
Syntax
<Result> = <Table control>.Select([<Rank> [, <Information to return>]])
<Result>: Integer
  • Index of the selected element in the specified Table control,
  • -1 if no element is selected.
<Table control>: Control name
Name of the control to be used. This control can correspond to:
  • a Table control.
  • a TreeView Table control.
<Rank>: Optional integer
Rank of selection for a multi-selection control. If this parameter is not specified, the index of the first selected row is returned.
For example, to retrieve the first selected element, <Rank> = 1.
To retrieve the second selected element, <Rank> = 2, etc.
WEBDEV - Server codeWEBDEV - Browser codePHP This parameter is not available for Table controls in "Server" mode.
<Information to return>: Optional Integer constant
Type of information to return:
tsCellColumn<Result> will correspond to the column number for the selected cell.
tsCellRow<Result> will correspond to the row number for the selected cell.
tsColumn<Result> will correspond to the number of the selected column.
tsRow
(Default value)
<Result> will correspond to the number of the selected row.
If this parameter is not specified, the function will return the number of the selected row.
AndroidiPhone/iPadJava This parameter is not available. The function will return the number of the selected row.
Remarks

Use conditions

<Table>.Select can be used on:
  • Table or TreeView Table controls based on a data file.
  • Table or TreeView Table controls populated programmatically.
  • single-selection or multi-selection controls. For multi-selection Table controls, you must use <Table>.Select in a loop to get all the selected rows.
    WEBDEV - Server codePHP Reminder: Multi-selection is not available for Table fields in "Server" mode.
WEBDEV - Server codePHP This function is available for Table controls in "Server" and "Server + AJAX" mode, and for TreeView Table controls.
WEBDEV - Browser code This function is available for Table controls in "Browser" mode only.
WEBDEV - Browser code The TreeView Table control is not available.

Equivalence <Table>.Select

The following syntaxes are equivalent:
Indice est un entier
Indice = <Champ Table>
or
Indice = <Champ Table>.Select()

Value of the selected element

To retrieve the value of the selected element, the syntax is:
Indice est un entier
Indice = <Champ Table>.Select()
<Valeur de l'élément> = <Champ Table> [Indice]
or
<Valeur de l'élément> = <Champ Table> [<Champ Table>]
WINDEVJava

Selection at cell level

If the "multiple selection" mode is enabled for the cells of a control, you can use the Selected property to select a cell in the code or to know whether a cell is selected.
Component: wd300obj.dll
Minimum version required
  • Version 23
This page is also available for…
Comments
Select ID
Prezados

Para pegar um registro id de um browser table grid tem 2 formas:

Crie uma var global da janela:
GNID is 8-byte int = 0


A) Em Code evento
SELECT ROW

GNID = TableNameGrid.COL_myID



B) Em Code evento
SELECT ROW

Nx is int = Tableinfoxy(TableNameGrid, tiLineNumber, MouseXPos(), MouseYPos())

If nx > 0

GNID = TableNameGrid[nx].COL_myID

End
Boller
16 Apr. 2024

Last update: 09/18/2024

Send a report | Local help