PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Use conditions
  • Type of search
  • Browsing table
  • Miscellaneous
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
Warning
From version 27, TableSeek is kept for backward compatibility. This function is replaced by TableSearch.
Performs a search in:
  • a Table control,
  • a TreeView Table control,
  • WINDEV a table displayed in a Combo Box control.
Two search modes are available:
  • Search for an element in a column.
  • Search for an element in the stored value of control.
Versions 16 and later
WINDEVLinux This function is now available for WINDEV applications in Linux.
New in version 16
WINDEVLinux This function is now available for WINDEV applications in Linux.
WINDEVLinux This function is now available for WINDEV applications in Linux.
Example
// Finds the "Shirt" element in the "COL_Product" column
// Generic search performed from row 5
let ResSearch = TableSearch(COL_Product, "Shirt", searchStartsWith, 5)
// Used to list all occurrences of a sought value.
Result1 is int
Result1 = TableSearch(COL_ColumnName, "SoughtValue", searchExactMatch)
WHILE Result1 <> -1
Trace(Result1)
Result1 = TableSearch(COL_ColumnName, "SoughtValue", ...
searchExactMatch, Result1 + 1)
END
Syntax

Searching for an element in a column Hide the details

<Result> = TableSearch(<Column name> , <Sought element> [, <Type of search> [, <Source row>]])
<Result>: Integer
  • Index of the element found,
  • -1 if no element corresponds to the search.
If the search is performed:
  • in a memory Table control, the element found is not selected. To select the element found, use TableSelectPlus.
  • in a browsing Table control, the element found is not selected, the rows found in the Table control scroll until the sought element is reached.
<Column name>: Character string
Name of column where the search is performed.
If this parameter corresponds to an empty string (""), the column to which the current process belongs will be used.
In a browsing Table or TreeView Table control, the search column must be linked to a key item. No search can be performed on a column that is not linked to an item.
<Sought element>: Type of sought element
Element that must be found in the specified column. If the type of the sought element is:
  • "Date" or "Time": the search is performed on the returned value.
  • "Currency + Euro": the search is performed on the stored currency.
<Type of search>: Optional Integer constant
Type of search to perform:
Versions 21 and later
searchStartsWith
New in version 21
searchStartsWith
searchStartsWith (or False for compatibility)
Generic search whose type is "Starts with"
The elements whose value starts with <Sought element> are returned.
Caution: In a memory Table control, leading spaces ignored.
Versions 21 and later
searchContains
New in version 21
searchContains
searchContains
Generic search whose type is "Contains"
The elements whose value contains <Sought element> are returned.
Versions 21 and later
searchDefault
New in version 21
searchDefault
searchDefault
Default search. for this function, the default search is an exact-match search (whose type is "Equals to").
The elements whose value is strictly equal to <Sought element> are returned.
Caution: In a memory Table control, leading spaces ignored.
Versions 21 and later
searchExactMatch
New in version 21
searchExactMatch
searchExactMatch (or True for compatibility)
(Default value)
Exact-match search ("Equals to")
The elements whose value is strictly equal to <Sought element> are returned.
Caution: In a memory Table control, leading spaces ignored.
<Source row>: Optional integer
Number of the source row for the search.
If this parameter is not specified, the search is performed in the entire column.
This parameter is used to find all the occurrences of a string in a column.
This parameter is ignored for a browsing Table control.
WINDEVUser code (UMC)

Searching for an element in a Table control (stored value) Hide the details

<Result> = TableSearch(<Table control> , <Sought value>)
<Result>: Integer
  • Index of the element found,
  • -1 if no element corresponds to the search.
<Table control>: Control name
Name of the control to be used. This control can correspond to:
  • a Table control.
  • a TreeView Table control.
  • WINDEV a Combo Box control with table.
The Table control must be linked to a data file or to a variable.
<Sought value>: Type of sought element
Value of sought element. This value is sought in the stored value of control.
Remarks

Use conditions

Syntax 1: Search in columns is available for:
  • a Table or TreeView Table control,
  • a browsing or memory control,
  • WINDEV a table displayed in a Combo Box control,
  • a single-selection or multi-selection control.
For a browsing Table or TreeView Table control:
  • the browse mode must be automatic.
  • the column must be linked to a key item.
WINDEVUser code (UMC) Syntax 2: Search in stored values is available for:
  • a Table or TreeView Table control.
  • a browsing control or a control linked to a variable.
  • a single-selection or multi-selection control.

Type of search

  • Exact-match search: The elements whose value is strictly equal to <Sought element> are returned by TableSearch. For example:
    // Return all customers whose name is "Smith" from "COL_NameColumn"
    TableSearch(COL_NameColumn, "Smith")
    Caution: In a memory Table control, leading spaces ignored.
  • Generic search: The elements starting with <Sought element> are returned by TableSearch.
    For example:
    // Return all customers whose name starts with "SMI"
    TableSearch(COL_NameColumn, "SMI", searchStartsWith)
WINDEVUser code (UMC)

Browsing table

  • In a browsing table, the following syntax can be used to search for an element in a column:
    TableName = SoughtElement
  • On browsing tables with direct access, when TableSearch is used:
    • the display of the Table control is moved.
    • the returned index corresponds to an "approximate" index because this type of Table control can manage billions of records.

Miscellaneous

  • In a memory Table control, the search performed with TableSearch:
    • is not case sensitive.
    • ignores leading spaces.
  • In a browsing Table control, the search performed by TableSearch takes into account the search characteristics defined in the analysis for the item bound to the search column (case sensitivity, etc.).
Business / UI classification: UI Code
Component: wd270obj.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Exemplo TableSeek - Ler uma Coluna Tabela
FOR ALL ROW OF TABLE_local // aqui estou varrendo toda tabela
Info(TABLE_local.COL_nome_arquivo) // estou mostrando uma coluna
n_existe is int=TableSeek(TABLE_remoto.COL_nome_arquivo,TABLE_local.COL_nome_arquivo,True) // estou lendo uma coluna tabela
IF n_existe<>-1 THEN // verificando se existe na tabela
Info("Existe na Tabela")
ELSE
Info("nao existe")
END
END
De matos AMARILDO
03 Jan. 2016