PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Miscellaneous
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Seeks the subscript of an element in a WLanguage array. The following searches can be performed:
  • Seek an element in a one-dimensional array of simple elements.
  • Seek an element in a two-dimensional array of simple elements according to a column.
  • Seek an element in a two-dimensional array of simple elements according to several columns.
  • Seek an element in a one-dimensional array of structures or classes.
  • Seeking an object in an array.
Notes:
  • This function is equivalent to Find.
Example
arrMyArray is array of 0 string
// Fill the array
ArrayAdd(arrMyArray, "WINDEV")
ArrayAdd(arrMyArray, "WEBDEV")
ArrayAdd(arrMyArray, "WINDEV and WEBDEV")
// Find "WINDEV"
ResSubscript is int
ResSubscript = ArraySeek(arrMyArray, asLinearFirst, "WINDEV")
Info("The WINDEV string is found at subscript: " + ResSubscript)
// Returns: "The WINDEV string is found at subscript: 1"
Reports and QueriesWindows
arrCalendar is array of gglCalendars
// Find a calendar identified by its title
ArraySeek(arrCalendar, asLinear, "title", "Professional calendar")
Syntax

Seeking an element in a one-dimensional array of simple elements Hide the details

<Result> = ArraySeek(<WLanguage array> , <Type of search> , <Sought value> [, <Start subscript>])
<Result>: Integer
  • Subscript of sought element,
  • -1 if the element is not found in the array.
<WLanguage array>: Array
Name of Array variable to use. This array must be a one-dimensional array.
This array can also correspond to a one-dimensional array associated with a property of advanced variable.
<Type of search>: Integer constant
Type of search to perform:
asBinaryBinary search.
This search mode is fast but it must be used on an array sorted in ascending order, without duplicates, and by using exactly the same search options as the ones used for the sort (see ArraySort).
asLinearLinear search. The search starts:
  • from the first element.
  • from <Start subscript>.
The search stops as soon as an element is found.
asLinearLastLinear search from the last element. This constant must not be used if <Start subscript> is specified.
asLinearPreviousLinear search for the previous element. This search is performed from the current position or from <Start subscript>.
asLinearFirstLinear search from the first element. <Start subscript> is ignored when this constant is specified.
asLinearNextLinear search for the next element. This search is performed from the current position or from <Start subscript>.

Versions 17 and later
The type of search can be combined with one or more search options:
tccLexicographicOrderArray sorted according to the linguistic order.
This option is useful for a dichotomous search and it has no effect on a linear search.
This option can only be used on the arrays of character strings.
tccRespectNumericArray sorted according to the order of numeric values.
This option is useful for a dichotomous search and it has no effect on a linear search.
This option can only be used on the arrays of character strings.
tccIgnoreAccentSearch while ignoring the accented characters.
This option can only be used on the arrays of character strings.
tccIgnoreCaseSearch while ignoring the case.
This option can only be used on the arrays of character strings.
tccIgnoreSpaceSearch while ignoring the space characters found at the beginning and at the end of strings.
This option can only be used on the arrays of character strings.
Versions 20 and later
tccIgnoreInsideSpace
New in version 20
tccIgnoreInsideSpace
tccIgnoreInsideSpace
Search while ignoring the space characters found inside the strings.
This option can only be used on the arrays of character strings.
tccIgnorePonctuationAndSpaceSearch while ignoring the space characters and the punctuation characters.
This option can only be used on the arrays of character strings.

New in version 17
The type of search can be combined with one or more search options:
tccLexicographicOrderArray sorted according to the linguistic order.
This option is useful for a dichotomous search and it has no effect on a linear search.
This option can only be used on the arrays of character strings.
tccRespectNumericArray sorted according to the order of numeric values.
This option is useful for a dichotomous search and it has no effect on a linear search.
This option can only be used on the arrays of character strings.
tccIgnoreAccentSearch while ignoring the accented characters.
This option can only be used on the arrays of character strings.
tccIgnoreCaseSearch while ignoring the case.
This option can only be used on the arrays of character strings.
tccIgnoreSpaceSearch while ignoring the space characters found at the beginning and at the end of strings.
This option can only be used on the arrays of character strings.
Versions 20 and later
tccIgnoreInsideSpace
New in version 20
tccIgnoreInsideSpace
tccIgnoreInsideSpace
Search while ignoring the space characters found inside the strings.
This option can only be used on the arrays of character strings.
tccIgnorePonctuationAndSpaceSearch while ignoring the space characters and the punctuation characters.
This option can only be used on the arrays of character strings.

The type of search can be combined with one or more search options:
tccLexicographicOrderArray sorted according to the linguistic order.
This option is useful for a dichotomous search and it has no effect on a linear search.
This option can only be used on the arrays of character strings.
tccRespectNumericArray sorted according to the order of numeric values.
This option is useful for a dichotomous search and it has no effect on a linear search.
This option can only be used on the arrays of character strings.
tccIgnoreAccentSearch while ignoring the accented characters.
This option can only be used on the arrays of character strings.
tccIgnoreCaseSearch while ignoring the case.
This option can only be used on the arrays of character strings.
tccIgnoreSpaceSearch while ignoring the space characters found at the beginning and at the end of strings.
This option can only be used on the arrays of character strings.
Versions 20 and later
tccIgnoreInsideSpace
New in version 20
tccIgnoreInsideSpace
tccIgnoreInsideSpace
Search while ignoring the space characters found inside the strings.
This option can only be used on the arrays of character strings.
tccIgnorePonctuationAndSpaceSearch while ignoring the space characters and the punctuation characters.
This option can only be used on the arrays of character strings.

For a dichotomous search, the search options must be exactly the same as the options that were used to sort the array (see ArraySort).
<Sought value>: Any type
Value of element whose subscript is requested.
<Start subscript>: Optional integer
Start position for the search (linear search only). This parameter is not required for a binary search.

Seek an element in a one-dimensional array of structures, classes, advanced types or records. Hide the details

<Result> = ArraySeek(<WLanguage array>, <Type of search>, <Sought members>, <Sought value 1 > , [ <Sought value 2> [ ... [, <Sought value N>]]] [, <Start subscript>])
<Result>: Integer
  • Subscript of sought element,
  • -1 if the element is not found in the array.
<WLanguage array>: Array
Name of Array variable to use. This array must be a one-dimensional array. This array can be:
  • an array of classes,
  • an array of structures,
  • an array of advanced types,
<Type of search>: Integer constant
Type of search to perform:
asBinaryBinary search.
This search mode is fast but it must be used on an array sorted in ascending order, without duplicates, and by using exactly the same search options as the ones used for the sort (ArraySort).
This search mode can also be used when performing a search on a single member.
asLinearLinear search. The search starts:
  • from the first element.
  • from <Start subscript>.
The search stops as soon as an element is found.
asLinearLastLinear search from the last element. This constant must not be used if <Start subscript> is specified.
asLinearPreviousLinear search for the previous element. This search is performed from the current position or from <Start subscript>.
asLinearFirstLinear search from the first element. This constant must not be used if <Start subscript> is specified.
asLinearNextLinear search for the next element. This search is performed from the current position or from <Start subscript>.

Versions 17 and later
The type of search can be combined with one or more search options:
tccLexicographicOrderArray sorted according to the linguistic order.
This option is useful for a dichotomous search and it has no effect on a linear search.
This option is applied to all members on which the search is performed.
This option is useful for the "character string" members.
tccRespectNumericArray sorted according to the order of numeric values.
This option is useful for a dichotomous search and it has no effect on a linear search.
This option is applied to all members on which the search is performed.
This option is useful for the "character string" members.
tccIgnoreAccentSearch while ignoring the accented characters.
This option is applied to all members on which the search is performed.
This option is useful for the "character string" members.
tccIgnoreCaseSearch while ignoring the case.
This option is applied to all members on which the search is performed.
This option is useful for the "character string" members.
tccIgnoreSpaceSearch while ignoring the space characters found at the beginning and at the end of strings.
This option is applied to all members on which the search is performed.
This option is useful for the "character string" members.
Versions 20 and later
tccIgnoreInsideSpace
New in version 20
tccIgnoreInsideSpace
tccIgnoreInsideSpace
Search while ignoring the space characters found inside the strings.
This option is applied to all members on which the search is performed.
This option is useful for the "character string" members.
tccIgnorePonctuationAndSpaceSearch while ignoring the space characters and the punctuation characters.
This option is applied to all members on which the search is performed.
This option is useful for the "character string" members.

New in version 17
The type of search can be combined with one or more search options:
tccLexicographicOrderArray sorted according to the linguistic order.
This option is useful for a dichotomous search and it has no effect on a linear search.
This option is applied to all members on which the search is performed.
This option is useful for the "character string" members.
tccRespectNumericArray sorted according to the order of numeric values.
This option is useful for a dichotomous search and it has no effect on a linear search.
This option is applied to all members on which the search is performed.
This option is useful for the "character string" members.
tccIgnoreAccentSearch while ignoring the accented characters.
This option is applied to all members on which the search is performed.
This option is useful for the "character string" members.
tccIgnoreCaseSearch while ignoring the case.
This option is applied to all members on which the search is performed.
This option is useful for the "character string" members.
tccIgnoreSpaceSearch while ignoring the space characters found at the beginning and at the end of strings.
This option is applied to all members on which the search is performed.
This option is useful for the "character string" members.
Versions 20 and later
tccIgnoreInsideSpace
New in version 20
tccIgnoreInsideSpace
tccIgnoreInsideSpace
Search while ignoring the space characters found inside the strings.
This option is applied to all members on which the search is performed.
This option is useful for the "character string" members.
tccIgnorePonctuationAndSpaceSearch while ignoring the space characters and the punctuation characters.
This option is applied to all members on which the search is performed.
This option is useful for the "character string" members.

The type of search can be combined with one or more search options:
tccLexicographicOrderArray sorted according to the linguistic order.
This option is useful for a dichotomous search and it has no effect on a linear search.
This option is applied to all members on which the search is performed.
This option is useful for the "character string" members.
tccRespectNumericArray sorted according to the order of numeric values.
This option is useful for a dichotomous search and it has no effect on a linear search.
This option is applied to all members on which the search is performed.
This option is useful for the "character string" members.
tccIgnoreAccentSearch while ignoring the accented characters.
This option is applied to all members on which the search is performed.
This option is useful for the "character string" members.
tccIgnoreCaseSearch while ignoring the case.
This option is applied to all members on which the search is performed.
This option is useful for the "character string" members.
tccIgnoreSpaceSearch while ignoring the space characters found at the beginning and at the end of strings.
This option is applied to all members on which the search is performed.
This option is useful for the "character string" members.
Versions 20 and later
tccIgnoreInsideSpace
New in version 20
tccIgnoreInsideSpace
tccIgnoreInsideSpace
Search while ignoring the space characters found inside the strings.
This option is applied to all members on which the search is performed.
This option is useful for the "character string" members.
tccIgnorePonctuationAndSpaceSearch while ignoring the space characters and the punctuation characters.
This option is applied to all members on which the search is performed.
This option is useful for the "character string" members.

For a dichotomous search, the search options must be exactly the same as the options that were used to sort the array (see ArraySort).
<Sought members>: Character string (with quotes)
  • Structures and classes: Name of sought members. If several members are sought, their names must be separated by a semicolon. You also have the ability to chain the sought members (by using "." or ":" between the members). In a class, you also have the ability to perform a search on the class properties.
  • Advanced types: Name of sought properties. If several properties are sought, their names must be separated by a semicolon. You also have the ability to chain the sought properties (by using "." or ":" between the properties). For example, "Border.Color".
  • Versions 22 and later
    Records: Name of sought items. If several items are sought, their names must be separated by a semicolon. You also have the ability to chain the sought items (by using "." or ":" between the properties).
    New in version 22
    Records: Name of sought items. If several items are sought, their names must be separated by a semicolon. You also have the ability to chain the sought items (by using "." or ":" between the properties).
    Records: Name of sought items. If several items are sought, their names must be separated by a semicolon. You also have the ability to chain the sought items (by using "." or ":" between the properties).
<Sought value 1>: Any type
Value of element whose member or property is requested. A value must be indicated for each member specified in <Sought members>.
<Sought value 2>: Any optional type
Value of element whose member or property is requested. A value must be indicated for each member specified in <Sought members>.
<Sought value N>: Any optional type
Value of element whose member or property is requested. A value must be indicated for each member specified in <Sought members>.
<Start subscript>: Optional integer
Start position for the search (linear search only). This parameter is not required for a binary search.

Seeking the subscript of an object in a one-dimensional array (syntax for the databinding) Hide the details

<Result> = ArraySeek(<WLanguage array> , <Type of search> , <Sought object>)
<Result>: Integer
  • Subscript of the sought object,
  • -1 if the object is not found in the array.
<WLanguage array>: Array
Name of Array variable to use. This array must be a one-dimensional array. This array can be an array of classes, dynamic classes, structures, dynamic structures, advanced types, dynamic advanced types.
<Type of search>: Integer constant
Type of search to perform:
asLinearLinear search.
<Sought object>: Any type
Instance of sought object.
Remarks

Miscellaneous

  • This function cannot be used on the fixed arrays.
  • This function can be used on the arrays of advanced variables.
  • This function cannot be used on the array of "Dynamic objects". The type of the objects must be specified.
  • This function must be used on the arrays of objects with a defined type.
    • For example, no search can be performed in the following array:
      t is array of 2 objects dynamic
    • On the contrary, a search can be performed in the following array:
      t is array of 2 MyClass

      t is array of 2 MyClass dynamic
  • No search can be performed on an array of variants.
Component : wd240vm.dll
Minimum required version
  • Version 9
This page is also available for…
Comments
ArraySeek é obrigatório usar em column usar texto entre aspas
Prezados,

ArraySeek é obrigatório usar em column usar texto entre aspas:

arrMyArray is array of 0 string
// Fill the array
ArrayAdd(arrMyArray, 1)
ArrayAdd(arrMyArray, 2)
ArrayAdd(arrMyArray, 3)

// Find "2"

ResSubscript is int
ResSubscript = ArraySeek(arrMyArray, asLinearFirst, "2") //USAR ASPAS

Info("The 2 string is found at subscript: " + ResSubscript)

// Returns: "The 2 string is found at subscript: 2"
BOLLER
Mar. 07 2017
seek using a Structure`
 x = ArraySeek(ArrayVar,searchtype,"element1;element2",value1,value2)
Andy <<cowboy>>
Mar. 05 2012