|
|
|
|
|
- Use conditions
- Type of search
- Table control based on a data file
- Miscellaneous
TableSearch (Function) In french: TableCherche
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,
- 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.
// Searches for 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> , <Search 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 Table control populated programmatically, the element found is not selected. To select the element found, use TableSelectPlus.
- in a Table control based on a data file, the element found is not selected, the rows in the Table control scroll until the search element is reached.
<Column name>: Character string Name of the 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 Table or TreeView Table control based on a data file, the search column must be bound to a key item. No search can be performed in a column that is not bound to an item. <Search element>: Type of search element Element to be found in the specified column. If the type of the search 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:
| | searchContains | Generic search of type "Contains" The elements whose value contains <Search element> are returned. | 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 <Search element> are returned. Caution: In a Table control populated programmatically, leading spaces are ignored. | searchExactMatch (or True for compatibility) (Default value) | Exact-match search ("Equals to") The elements whose value is strictly equal to <Search element> are returned. Caution: In a Table control populated programmatically, leading spaces are ignored. | searchStartsWith (or False for compatibility) | Generic search whose type is "Starts with" The elements whose value starts with <Search element> are returned. Caution: In a Table control populated programmatically, leading spaces are 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 in Table controls based on a data file. Remarks Use conditions Syntax 1: Search in columns is available for: - Table or TreeView Table controls based on a data file.
- Table or TreeView Table controls populated programmatically.
- tables displayed in a Combo Box control,
- Table controls in "Browser" mode,
- single-selection or multi-selection controls.
Reminder: Multi-selection is not available for Table controls in "Server" mode.
For a Table or TreeView Table control based on a data file: - the iteration mode must be automatic.
- the column must be bound to a key item.
Type of search - Exact-match search: The elements whose value is strictly equal to <Search element> are returned by TableSearch. For example:
// Return all customers whose name is "Smith" from "COL_NameColumn" TableSearch(COL_NameColumn, "Smith")
Caution: In a Table control populated programmatically, leading spaces are ignored. - Generic search: The elements starting with <Search element> are returned by TableSearch.
For example:
// Return all customers whose name starts with "SMI" TableSearch(COL_NameColumn, "SMI", searchStartsWith)
Miscellaneous - In a Table control populated programmatically, the search performed with TableSearch:
- is not case sensitive.
- ignores leading spaces.
- In a Table control based on a data file, 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
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|