PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • Generic search/Exact-match search
  • Exact-match search in Access
  • Performing a search on a composite key
  • Search on an array item
  • Search and filter
  • Browsing the records corresponding to a condition
  • The views and RPC on HFSQL
  • Optimizing the browse operations
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
Positions on the first file record whose value for a specific item is greater than or equal to a sought value (generic search). The record is read and the corresponding HFSQL variables are updated.
In most cases, HReadSeek is used to position in the data file in order to perform a browse loop among the records corresponding to a condition. HReadNext is used to read the next record corresponding to the condition.Several cases may occur after the call to HReadSeek:
  • a record corresponding to the condition was found, locked (if necessary) and loaded in memory: HFound returns True.
    Windows Mobile The management of locks is performed on the HFSQL Client/Server data files and on the data files handled by Native Access. A HFSQL Mobile record cannot be locked. Indeed, the operating system of Pocket PC does not allow you to lock records.
    Java Access by JDBC: The management of locks is not available for the databases accessed by JDBC.
  • the data file is empty or there is no record corresponding to the condition: no reading is performed and HOut returns True.
This function can be used with the data files, HFSQL views or queries.
Notes:
  • By default, HReadSeekFirst and HReadSeekLast are used to perform exact-match searches.
  • By default, HReadSeek is used to perform a generic search on the character strings. This search is not a generic search on the integers, the reals, the dates, the currencies, ...
Versions 15 and later
Android This function is now available for the Android applications.
New in version 15
Android This function is now available for the Android applications.
Android This function is now available for the Android applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the 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.
Note: 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.
// Find the first record
// for which the CUSTOMER name is MOORE
HReadSeek(CUSTOMER, NAME, "MOORE")
IF HFound() THEN
Trace("Customer MOORE found")
ELSE
Trace("Customer MOORE not found")
END
Syntax
<Result> = HReadSeek(<File Name> , <Item Name> , <Sought Value> [, <Options>])
<Result>: Boolean (optional)
Corresponds to:
  • True if the sought record was found and read. The file buffer is loaded with the data of the record found. In this case, HError is set to 0 and HFound is set to True.
  • False in the following cases:
    • error while accessing the file (unable to read for example). HError returns an error code. HErrorInfo returns more details about the error. In this case, HFound cannot be used.
    • the access to the file was performed but no record was found. In this case, HError is set to 0 and HFound is set to False.
    Caution: In this case, the file buffer cannot be used.
<File Name>: Character string (with or without quotes)
Name of data file, HFSQL view or query used.
<Item Name>: Character string (with or without quotes)
Name of item on which the search will be performed.
For an exact-match search, this parameter can correspond to a non-key item.
Hyper File 5.5 To perform generic searches on a composite key, all the components of the composite key must be text components. Otherwise, an exact-match search is performed.
<Sought Value>: Type corresponding to the value
Value of sought item.
<Options>: Optional constant (or combination of constants)
Used to configure:
  • the lock mode applied to the sought record.
  • the type of search performed.
hLockWriteLock in write mode: the record currently read can be read by another application but it cannot be modified by another application.
The lock mode is ignored if a query is used.
PHP The management of locks is not available.
Java Access by JDBC: This constant is not available.
hLockReadWriteLock in read/write: the record currently read cannot be read or modified by another application.
The lock mode is ignored if a query is used.
ODBC Lock in write-only. Operating mode equivalent to the hLockWrite constant.
PHP The management of locks is not available.
Java Access by JDBC: This constant is not available.
hLockNoNo lock (even if HStartLock was called): the record can be read or modified by another application during the reading.
PHP The management of locks is not available.
Java Access by JDBC: This constant is not available.
hIdenticalExact-match search (see the Notes)
A generic search is performed by default (constant not specified).
Java Access by JDBC: This constant is not available.
hLimitParsing
ODBCNative Accesses The browse will stop as soon as the last sought value is found. The current record will correspond to this last record found.
HFound will be set to False and HOut will be set to True.
This constant is used to optimize the search speed in client/server mode.
This constant is recommended when performing a simple search (without browsing the elements found).
HFSQL Client/Server This constant is not available.
hKeepFilterThe filter implemented by HFilter will be taken into account, even if the search key is not optimized for the filter. Reminder: HFilter returns the search key optimized for the filter.
Caution: in this case, lack of performances may occur on huge data files.
Hyper File 5.5 This variable cannot be used.
hNoRefresh
PHPODBCNative Accesses HReadSeek does not refresh the content of the table or query. The query is not re-run if possible. All the saved positions are stored.
Windows Mobile The management of locks is performed on the HFSQL Client/Server data files and on the data files handled by native access. A HFSQL Mobile record cannot be locked. Indeed, the operating system of Pocket PC does not allow you to lock records.
ODBCNative Accesses The lock options will have no effect if the locks are not supported by the OLE DB provider or by the Native Access.
Java Access by JDBC: The management of locks is not available for the databases accessed by JDBC.
Remarks
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppPHPAjaxUser code (UMC)HFSQLHFSQL Client/ServerHyper File 5.5OLE DBNative Accesses

Generic search/Exact-match search

A generic search or an exact-match search will be performed according to <Sought Value>.
  • Generic search: search for all the records that start with the specified value
    To perform a generic search, the requested value must be specified in <Sought Value>.
    Note: For backward compatibility with WINDEV 5.5, the generic search of an empty string ("") is equivalent to the use of HReadFirst.
  • Exact-match search: search for all the records that exactly correspond to 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. To perform an exact-match search, you also have the ability to use the hIdentical constant.
    To perform an exact-match search, you also have the ability to use HReadSeekFirst.
Caution: If you are using Hyper File 5.5 files or files in Hyper File 5.5 format migrated to HFSQL Classic, the implementation of generic searches and exact-match searches may change. See the Hyper File 5.5 and HFSQL Classic: How to manage the space characters in the searches? table for more details
WINDEVWEBDEV - Server codeReports and QueriesPHPAjaxUser code (UMC)Native Accesses

Exact-match search in Access

To perform an exact-match search on an ACCESS database, we recommend that you use NoSpace if space characters are found at the end of the sought value.
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppJavaPHPAjaxUser code (UMC)HFSQLHFSQL Client/ServerHyper File 5.5OLE DBNative Accesses

Performing a search on a composite key

Several methods can be used to perform a search on a composite key:
1. Using a list of values
The following syntax is used to perform a search on a composite key:
HReadSeek(<File Name>, <Name of Composite Key>,
[<Search Value of First Element of Composite Key>,
<Search Value of Second Element of Composite Key>, ...])
Example:
// Find the record
HReadSeek(CUSTOMER, LASTNAME_FIRSTNAME, ["MOORE","Vince"])

WHILE HFound(CUSTOMER)
        // Process
        HReadNext(CUSTOMER, LASTNAME_FIRSTNAME)
END
2. Using HBuildKeyValue
If the sought item is a composite key, the value to find can be built by HBuildKeyValue.
3. Using HConvert (backward compatibility with WINDEV 5.5)
To build the value of a composite key without using HBuildKeyValue, you must:
  • fill the text components on their entire size with Charact(0).
  • convert the numeric components with HConvert.
Example:
MyCompositeKey = Complète(Customer.CustomerLastName, Dimension(Customer.LastName), Charact(0)) + ...
        Complète(Customer.FirstName, Dimension(Customer.FirstName), Charact(0))
Hyper File 5.5 To perform generic searches on a composite key, all the components of the composite key must be text components. Otherwise, an exact-match search is performed.
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppJavaPHPAjaxUser code (UMC)HFSQLHFSQL Client/ServerHyper File 5.5OLE DBNative Accesses

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.
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppJavaPHPAjaxUser code (UMC)HFSQLHFSQL Client/ServerHyper File 5.5OLE DBNative Accesses

Search and filter

If a filter is enabled (HFilter), the filter is taken into account by the search only if the key used is identical.
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppJavaPHPAjaxUser code (UMC)HFSQLHFSQL Client/ServerHyper File 5.5OLE DBNative Accesses

Browsing the records corresponding to a condition

In most cases, HReadSeek is used to position in the data file in order to perform a browse loop among the records corresponding to a condition. HReadNext and HReadPrevious are used to read the next and previous records corresponding to the condition.
To ignore the search while going to the next or previous record, use one of the following functions:
WINDEVWEBDEV - Server codeReports and QueriesWindows MobilePHPAjaxUser code (UMC)HFSQLHFSQL Client/ServerHyper File 5.5

The views and RPC on HFSQL

The search on a HFSQL view via a remote access (RPC on HFSQL) operates according to two different methods:
  • if the group of records selected by the view has not been previously brought back to the local computer, a call to the server is performed in order to search for the specified value.
    This solution is recommended if the size of the view is important and/or if a small number of searches must be performed.
  • if the group of records selected by the view has been previously brought back to the local computer, the search is performed on the local computer directly (no need to call the server).
    This solution is recommended if the size of the view is not very important and/or if a large number of searches must be performed.
    To bring back all the records selected by the view to the local computer, you can:
    • call HCreateView and specify an important number of records per page (<Page Size> parameter) then start the search with HReadFirst (recommended method).
    • create a loop used to browse all the records selected by the view (HReadFirst and HReadNext).
      Note: This solution triggers an important exchange of data during the first access to the view.
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadUniversal Windows 10 AppPHPAjaxUser code (UMC)HFSQLHFSQL Client/ServerHyper File 5.5OLE DBNative Accesses

Optimizing the browse operations

To optimize the time of the first browses performed on a data file, use HOptimize on this data file.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230hf.dll
Windows Mobile wp230hf.dll
Java wd230java.jar
Linux wd230hf.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment