PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN

This content has been translated automatically. Click here to view the French version.
  • Generic search/Exact-match search
  • Space characters at the end of item
  • Performing a search on a composite key
  • Search on an array item
  • Search and filter
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
HSeek (Function)
In french: HRecherche
ODBCNot available with this kind of connection
Positions on the first record of the data file whose value for a specific item is greater than or equal to a sought value (generic search by default). The record is not read. To read the record, use HReadSeek.

The number of the current Record is changed only when it is returned by the HRecNum function. For the functions handling by default the number of the current Record (functions HDelete, HRead, HModify, ...), the value of this number is not updated: you must use HRecNum(). For example: not to do:
HDelete(Client)
but
HDelete(Client, HRecNum())
get is from the smallest to the largest value of the path heading (see notes for details).
Caution: The record loaded in memory is not modified. The HFSQL variables (Customer.Name for example, which means the Name item of Customer file) are not updated.
In general, the HSeek function is used to position oneself in the data file to perform a loop among the records corresponding to a condition. HNext is used to position on the next record corresponding to the condition.
Several cases may occur after the call to HSeek:
  • a record corresponding to the condition was found: function HFound returns True
  • the data file is empty or there is no record corresponding to the condition: function HOut returns True
Remarks:
  • By default, HSeekFirst and HSeekLast are used to perform an exact-match search.
  • By Default, the function HSeek performs a generic search.
Versions 15 and later
Android This function is now available for Android applications.
New in version 15
Android This function is now available for Android applications.
Android This function is now available for Android applications.
Versions 17 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Remark: From version 19, HFSQL is the new name of HyperFileSQL.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Example
// Recherche générique du premier enregistrement pour lequel
// le code postal commence par "75"
HSeek(Client, CP, "75")
// Recherche du premier enregistrement à l'identique
// pour lequel le nom du Client est Dupond
// Mode 7: Rubrique texte terminée par Caract(0)
HSeek(Client, Nom, "Dupond" + Charact(0))
 
// Mode 5.5: Rubrique texte complétée par des espaces
HSeek(Client, Nom, Complète("Dupond", 30))
Syntax
<Result> = HSeek(<Data file> , <Key item> , <Sought value> [, <Options>])
<Result>: Boolean
  • True if the position was set,
  • False if an error occurred (lock, ...): the record is not read. This problem can be caused by:
    • a positioning problem (empty data file, ...): HFound returns False and HError returns 0.
    • an error: HError returns an integer other than 0. HErrorInfo returns more details.
<Data file>: Character string
Name of HFSQL data file used.
<Key item>: Character string
Name of key item on which the search will be performed.
<Sought value>: Type corresponding to the value
Value of sought item.
<Options>: Optional constant (or combination of constants)
Configures:
  • the lock mode applied to the sought record.
  • the type of browse
  • the type of search performed.
hLockReadWriteLock in read/write: the record currently read cannot be read or modified by another application.
OLE DB Lock in write-only. Operating mode equivalent to the hLockWrite constant.
hLockWriteLock in write mode: the record currently read can be read by another application but it cannot be modified by another application.
hLockNoNo lock: the record can be read or modified by another application during the reading.
hIdenticalExact-match search (see the Notes).
A generic search is performed by default (parameter not specified).
hLimitParsingThe browse will stop as soon as the last sought value is found. The current record will correspond to the record found. In this case, HFound returns False and HOut returns True.
This constant is used to optimize the speed in Client/Server mode.
hKeepFilterThe path will take into account the filter set up with the HFilter function, even if the path key used is not optimized for the filter. Reminder: function HFilter returns the optimized path key for the filter.
Caution: in this case, performance issues may arise for large files.
Hyper File 5.5 This variable cannot be used.
Java Access by JDBC: This parameter is ignored.
OLE DBNative Connectors (Native Accesses) The lock options will have no effect if the locks are not supported by the OLE DB provider or by the Native Connector.
Hyper File 5.5 The lock options are ignored. Use blocking get functions (HLitFirstBlockfunction) kept by compatibility.
Remarks

Generic search/Exact-match search

A generic search or an exact-match search will be performed according to <Sought value>.
  • For a generic search: performs a search on all the records that starts by the specified value
    To perform a generic search, the requested value must be specified in <Sought value>.
  • For an exact-match search: performs a search of all the records that exactly match the specified value.
    To perform an exact-match search, the size of the search argument must be exactly the same as the size of the key. The search argument must be filled with "space" characters for the text keys. To do so, use Complete.

Space characters at the end of item

By default, when reading a record, the space characters found at the end of the text items are not deleted in the file variables.
In order for the space characters to be deleted, use WithSpace.

Performing a search on a composite key

Several methods can be used to perform a search on a composite key:
Using a list of values
The following syntax is used to perform a search on a composite key:
HRecherche(<Nom du fichier>, <Nom de la clé composée>, ...
[<Valeur de recherche du premier élément de la clé composée>,
<Valeur de recherche du deuxième élément de la clé>, ...])
Example:
// Recherche de l'enregistrement
HSeek(Client, Nom_Prénom, ["MOULIN","Françoise"])
Hyper File 5.5 To perform generic searches on a composite key, all the components of composite key must be Text components. Otherwise, an exact-match search is performed.

Search on an array item

The search is performed on the first array element (element whose subscript is 1). To perform a search on the other array elements, use the filters or queries.

Search and filter

If a filter is enabled (HFilter), this filter is taken into account during the search.
Component: wd270hf.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment