ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / Table functions
  • Use conditions
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
Returns the number of selected elements in a Table or TreeView Table control (especially for a multi-selection control).
The number of selected elements can correspond to:
  • the number of selected rows (current rows onto which the selection bar is displayed).
  • the number of selected cells if the controls allows the selection mode by cell. This option can be configured in the "UI" tab of the control description.
  • the number of selected columns if the control allows the selection mode by column. This option can be configured in the "UI" tab of the control description.
Example
// Traces the content of the selected rows
// (The Table control is a multi-selection Table control)
i is int
NbSelected is int
NbSelected = TableSelectCount(TABLE_Product)
FOR i = 1 TO NbSelected
Trace("Selected row: " + ...
TABLE_Product[TableSelect(TABLE_Product, i)])
END
// Deletes all selected rows from a Table control
// (The Table control is a multi-selection Table control)
// TableDeleteSelect is available from version 18
i is int
NbSelection is int = TableSelectCount(TABLE_MyTable)
FOR i = NbSelection TO 1 STEP -1
TableDelete(TABLE_MyTable, TableSelect(TABLE_MyTable, i))
END
Syntax
<Result> = TableSelectCount(<Table control> [, <Information to return>])
<Result>: Integer
  • Number of selected rows in the specified control,
  • 0 if no row is selected.
This number can be greater than 1 for multi-selection controls.
<Table control>: Control name
Name of the control to be used. This control can correspond to:
  • a Table control.
  • a TreeView Table control.
If this parameter corresponds to an empty string (""), the control to which the current event belongs is used.
A WLanguage error occurs if this parameter does not correspond to the name of a Table or TreeView Table control.
<Information to return>: Integer constant
Type of information to return:
tsCell<Result> will correspond to the number of selected cells.
tsColumn<Result> will correspond to the number of selected columns.
tsRow
(Default value)
<Result> will correspond to the number of selected rows.

If this parameter is not specified, the function will return the number of selected rows.
AndroidiPhone/iPadJava This parameter is not available.
Remarks

Use conditions

TableSelectCount can be used on:
  • a Table or TreeView Table control based on a data file.
  • a Table or TreeView Table control populated programmatically.
  • a single-selection or multi-selection control.
    WEBDEV - Server codePHP Reminder: Multi-selection is not available for Table controls 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.
Component: wd290obj.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Para capturar os itens que selecionou numa Lista ou numa table
Para capturar os itens que selecionou numa table, ative em description para aceitar multiselect, coloque um novo botao na tela ao lado do controle de table e informe o seguinte código:

//Capturar valores de uma Table com Mutiplas Seleções
Total is int = TableSelectCount(TableGrid_Clientes)
x is int
Loop(total)
x++
trace(TableGrid_Clientes[TableSelect(TableGrid_Clientes, x)])
trace(TableGrid_Clientes[TableSelect(TableGrid_Clientes, x)].COL_Codigo)
trace(TableGrid_Clientes[TableSelect(TableGrid_Clientes, x)].COL_Nome)
end

//-----

//Capturar valores de uma List com Mutiplas Seleções
Total is int = ListSelectCount(List_Clientes)
x is int
Loop(total)
x++
trace(List_Clientes[ListSelect(List_Clientes, x)])
trace(List_Clientes[ListSelect(List_Clientes, x)]..Storevalue)
trace(List_Clientes[ListSelect(List_Clientes, x)]..value)
end
BOLLER
20 May 2019
Example
PROCEDURE Filhos(ID, MarcaDesmarca, Filho01, Filho02, Filho03)

//info(ID,MarcaDesmarca)

x is int = 0

registros is int = TableCount(TABLE_Select_Preferencias)

IF (ID > 0 AND Filho01 > 0) OR (ID > 0 AND Filho02 > 0) OR (ID > 0 AND Filho03 > 0) THEN

FOR i = 1 _TO_ registros

x+=1

IF TABLE_Select_Preferencias[x].COL_ID = Filho01 OR TABLE_Select_Preferencias[x].COL_ID = Filho02 OR TABLE_Select_Preferencias[x].COL_ID = Filho03 THEN

//Mudar a cor
IF MarcaDesmarca = 1
TABLE_Select_Preferencias[x].COL_X = True
TABLE_Select_Preferencias[x].COL_X..Color = DarkGreen
TABLE_Select_Preferencias[x].COL_Preferencia..Color = DarkGreen
TABLE_Select_Preferencias[x].COL_X..BrushColor = LightGreen
TABLE_Select_Preferencias[x].COL_Preferencia..BrushColor = LightGreen
ELSE IF MarcaDesmarca = 0
TABLE_Select_Preferencias[x].COL_X = False
TABLE_Select_Preferencias[x].COL_X..Color = Black
TABLE_Select_Preferencias[x].COL_Preferencia..Color = Black
TABLE_Select_Preferencias[x].COL_X..BrushColor = White
TABLE_Select_Preferencias[x].COL_Preferencia..BrushColor = White
END


END

END

END

adrianoboller
26 Nov. 2015

Last update: 06/20/2022

Send a report | Local help