|
|
|
|
|
- Records read
- Looping through a data file
- Memos
- Locks
- Miscellaneous
HRead (Function) In french: HLit
Not available with this kind of connection
Reads a record in a data file according to a given record number. This read mode is called "Direct access". The record read is loaded in memory. HState is used to find out the record status (active, crossed or deleted). In most cases, HRead is used to position in the data file in order to perform a read loop by specifying the record number. Several cases may occur after the call to HRead: - the specified record number does not exist (greater than the total number of records or negative): no reading is performed and function HOut returns True.
- the specified record number no longer exists (record scratched, deleted, etc.): no reading is performed and function HOut returns Faux.
Use HState to find out the record status. - the data file is empty: function HOut returns True.
- the function attempts to block a record already blocked in playback: function HErrorLock returns True and function HOut returns True.
This function can be used with the data files (indexed or not) and with the HFSQL views.
i is int
FOR i = 1 _TO_ HNbRec(Customer, hStateAll)
HRead(Customer, i)
IF HState() = hStateActive THEN
Info("Customer name: " + Customer.Name)
END
END
Syntax
<Result> = HRead([<Data file> [, <Record number> [, <Options>]]])
<Result>: Boolean - True if the record was read,
- False in the event of an error (block, end of data file, etc.): the record is not read.. HError is used to identify the error.
<Data file>: Optional character string Name of the HFSQL data file, view or query used.If this parameter is an empty string (""), HRead manipulates the last data file used by the last HFSQL function (function starting with "H"). <Record number>: Optional integer Number of the record to read.If this parameter is not specified (or is equal to 0 or to the hCurrentRecNum constant), HRead will read the current record.
<Options>: Optional constant Configures the lock set on the record read by HRead: | | hLockNo | No blocking: the recording can be played back or modified by another application during playback. | hLockReadWrite | Read/write lock: the record being read cannot be read or modified by another application. | hLockWrite | Write lock: the record currently read can be read by another application but it cannot be modified by another application. |
Remarks Looping through a data file Memos The memos associated with the record can be automatically read (or not) when reading the record. HSetMemo is used to customize this automatic read operation. If the memos are supported, the associated text memos are read when the record is read. The binary memos are read only when they are explicitly used ( HExtractMemo). Miscellaneous - The result of HFound must be ignored (HFound must be used for the searches performed by HReadSeekFirst and HReadSeekLast).
- HRecNum returns the current record number. The first record found in the data file is record #1.
- This function replaces HReadLock and HReadNoLock, which were kept for compatibility with WINDEV 5.5.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|