PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
New WINDEV, WEBDEV, WINDEV Mobile 25 feature!
  • Records read
  • Browsing a data file
  • Memos
  • Locks
  • Various
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
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. <Source>.State is used to find out the record status (active, crossed or deleted).
In most cases, <Source>.Read 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 <Source>.Read:
  • the specified record number does not exist (greater than the total number of records or negative): no reading is performed and <Source>.Out returns True.
  • the specified record number does not exist anymore (crossed record, deleted record, ...): no read operation is performed and <Source>.Out returns False.
    Use <Source>.State to find out the record status.
  • the data file is empty: <Source>.Out returns True.
  • the function tries to lock a record that is already locked in read-only: HErrorLock returns True and <Source>.Out returns True.

This function can be used with the data files (indexed or not) and with the HFSQL views.
Remark: From version 19, HFSQL is the new name of HyperFileSQL.
Example
// Sequential browse to display the name of all customers
i is int
FOR i = 1 _TO_ Customer.NbRec(hStateAll)
Customer.Read(i)
IF Customer.State() = hStateActive THEN
Info("Customer name: " + Customer.Name)
END
END
Syntax
<Result> = <Source>.Read([<Record number> [, <Options>]])
<Result>: Boolean
  • True if the record was read,
  • False if an error occurred (lock, end of data file, etc.): the record is not read. HError is used to identify the error.
<Source>: Type corresponding to the specified source
Name of HFSQL data file, view or query used.
<Record number>: Optional integer
Number of the record to read.
If this parameter is not specified (or if it is equal to 0 or to the hCurrentRecNum constant), <Source>.Read handles the current record.
OLE DBNative Connectors (Native Accesses) <Source>.Read reads the current record. You cannot specify a record number other than the current one. To specify the current record number, use the hCurrentRecNum constant.
<Options>: Optional constant
Configures the lock set on the record read by <Source>.Read:
hLockNoNo lock (even if HStartLock was called): the record can be read or modified by another application during the reading.
hLockWriteLock in write mode: the record currently read can be read by another application but it cannot be modified by another application.
hLockReadWriteLock in read/write: the record currently read cannot be read or modified by another application.
Hyper File 5.5 The lock options are ignored. Use the lock functions (<Source>.LockRecNum) kept for backward compatibility.
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.
Remarks
WEBDEV - Server codeAjaxHFSQLHFSQL Client/ServerStored proceduresHyper File 5.5

Records read

<Source>.Read is the only function that can be used to access a crossed or deleted record. If the record is deleted, the content of the record is not valid anymore.

Browsing a data file

<Source>.Read cannot be used to continue a browse started by <Source>.ReadFirst, <Source>.ReadNext.

Memos

The memos associated with the record can be automatically read (or not) when reading the record. <Source>.SetMemo 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 (<Source>.ExtractMemo).
WEBDEV - Server codeAjaxHFSQLHFSQL Client/ServerStored proceduresHyper File 5.5OLE DBNative Connectors (Native Accesses)

Locks

By default (<Options> not specified), the record is not locked.
If a lock is requested (hLockWrite or hLockReadWrite constant), the record will be read only if this record is not already locked.
There is no need to specify a lock parameter if the data file is locked by HStartLock: the lock specified by HStartLock is automatically taken into account. To ignore the lock specified by HStartLock, use the hLockNo constant.
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.

Various

The result of <Source>.Found must be ignored (<Source>.Found must be used for the searches performed by <Source>.ReadSeekFirst and <Source>.ReadSeekLast).
The current record number is returned by <Source>.RecNum. The first record found in the data file is record #1.
Component : wd250hf.dll
Minimum version required
  • Version 25
This page is also available for…
Comments
Click [Add] to post a comment