- Managing automatic identifiers
- Modifying the deleted or crossed records
- Modification conflict or deletion conflict
- Managing the duplicates and the integrity
- Version of the data file after a modification
- Managing the binary memos
- Modifying a record selected in a query
- Browsing and modifying a record
- xBase
HModify (Function) In french: HModifie
Not available with this kind of connection
Modifies the specified record or the record found in memory in the data file (query or view). The indexes corresponding to all the keys used in the data file are automatically updated. The memos are added (if necessary) if the management of memos is enabled ( HSetMemo. After the call to HModify: - it is recommended to configure the management of errors:
WINDEV proposes an automatic management of errors for the following types of errors: Duplicate error, integrity error, password error, modification conflict error and status error during modification conflict, lock error. See Assisted management of HFSQL errors for more details.
 It is recommended to check that no error was generated: Duplicate error, integrity error, password error, modification conflict error and status error during modification conflict. See Assisted management of HFSQL errors for more details. - If the management of duplicates is enabled and if the data file contains a unique key, HErrorDuplicates returns True if the value of modified key is not unique. The record is not modified.
- if a lock problem occurs (attempt to modify a locked record), HErrorLock returns True and the record is not modified.
Locks are managed only on HFSQL Client/Server data files or on data files handled by a Native Connector. An HFSQL Mobile record cannot be locked. Indeed, the operating system of Pocket PC does not allow you to lock records.
The management of locks is not available.
Access by JDBC: The management of locks is not available for databases accessed by JDBC. - the number of the current record is not modified. By default, the current browse is not affected.
Remark: This function can be used on a data file, an HFSQL view or a query. Versions 15 and later New in version 15 Versions 17 and later New in version 17 Versions 18 and later New in version 18 Remark: From version 19, HFSQL is the new name of HyperFileSQL. Versions 21 and later New in version 21
// Finds the record HReadSeekFirst(Customer, Name, "Smith") IF HFound() = True THEN // Modify a record in a data file // (record described by programming) Customer.FirstName = "Vince" Customer.City = "San Francisco" Customer.Zip = "94102" Customer.Country = "USA" HModify(Customer) END
// Modify current record of "Customer" // displayed in a window ScreenToFile() HModify(Customer)
Syntax
<Result> = HModify([<Data file> [, <Record number> [, <Options>]]])
<Result>: Boolean - True if the record was modified,
- False if a problem occurred (integrity error, duplicate error, etc.): the record is not modified. HError is used to identify the error.
<Data file>: Optional character string (with or without quotes) Name of data file, HFSQL view or query used. If this name is not specified, HModify will use the last data file used by the last HFSQL management function (function starting with "H"). <Record number>: Optional integer Number of the record to modify. The record loaded in memory is re-written on the specified record. If this number is greater than the total number of records found in the data file, intermediate deleted records will be created in order for the sequential reading of the data file (HRead) to be consistent.
If this parameter is not specified (equal to 0 or to the hCurrentRecNum constant), HModify will modify the current record in the data file.
CAUTION: Do not confuse the record number with the automatic identifier associated with the record. In most cases, these two numbers are not identical. The record number is returned by HRecNum.
To use the <Options> parameter, <Record number> must necessarily be specified.
<Options>: Optional constant Configures:- the effect of modification on the current browse,
- the mode for calculating the automatic identifier,
- the lock mode applied to the modified record. If no lock constant is specified, the modified record is unlocked.
Locks are managed only on HFSQL Client/Server data files or on data files handled by a Native Connector. An HFSQL Mobile record cannot be locked. Indeed, the operating system of Pocket PC does not allow you to lock records.
The management of locks is not available.
Access by JDBC: The management of locks is not available for databases accessed by JDBC.
- the management of duplicates,
- the management of integrity.
Remark: To use this parameter, <Record number> must necessarily be specified.
| | hAffectBrowse | Effect of modification on the browse: The modification affects the browse. For example, HReadNext used after HModify positions on the record found after the modified record (while taking its new values into account).CAUTION: In any case (hAffectBrowse constant used or not): if HModify is used in a browse and the value of the browse item is modified, the current record may be read again in the rest of the browse. Indeed, modifying the browse item updates the file index key. This modification is taken into account when reading the next records.
The hAffectBrowse constant has priority over the hWriteDefault constant. | hLockNo (default value) | Lock mode of modified record: No lock (even if HStartLock was used): the modified record will not be locked.
| hLockWrite | Lock mode of modified record: Lock in write mode: the modified record will be locked in write mode. This record can be read by another application but it cannot be modified by another application. Only the current application can modify it or unlock it.
| hLockReadWrite | Lock mode of modified record: Lock in read/write: the modified record will be locked in read/write. This record cannot be read or modified by another application. Only the current application can modify it, read it or unlock it.
| hWriteDefault (default value) | Effect of modification on the browse: The modification does not affect the current browse. For example, HReadNext used after HModify positions on the record found after the current record before the modification.
CAUTION: If HModify is used in a browse and the value of the browse item is modified, the current record may be read again in the rest of the browse. Indeed, modifying the browse item updates the file index key. This modification is taken into account when reading the next records.
The hAffectBrowse constant has priority over the hWriteDefault constant. | Versions 24 and laterhFalsifyTimestamp New in version 24hFalsifyTimestamp hFalsifyTimestamp | Management of Timestamp items: By default, a Timestamp item contains the date and time the record was created/modified. This constant is used to force the value of the Timestamp item with the value assigned to it (and not with the value calculated automatically). | hSetIdAuto | Mode for calculating the automatic identifier: The automatic identifier is not calculated during the addition: the identifier value will be the one stored during the addition. The next value of the identifier calculated by the HFSQL engine will correspond to the greatest value of the identifier in the file +1. A WLanguage error occurs if the hSetIdAuto and hForceIdAuto constants are used at the same time. | hForceIdAuto | Mode for calculating the automatic identifier: The automatic identifier is not calculated during the addition. The identifier corresponds to:- the value assigned to the item by programming (CUSTOMERID = 7 for example)
- the default identifier value specified in the data model editor (if the data file was just opened, with no record read)
- the identifier value found in memory (identifier value for the last record read in the data file).
Once the record is added, the next automatic identifier calculated by the HFSQL engine will be calculated while ignoring the value added by hForceIdAuto. A WLanguage error occurs if the hSetIdAuto and hForceIdAuto constants are used at the same time. | hIgnoreDuplicates | Management mode of duplicates: Ignores the duplicate check for this operation, even if the automatic duplicate check is enabled (HSetDuplicates). A WLanguage error occurs if the hIgnoreDuplicates and hCheckDuplicates constants are used at the same time.
| hIgnoreIntegrity | Management mode of integrity: Ignores the integrity check for this add operation, even if the automatic integrity check is enabled (HSetIntegrity). A WLanguage error occurs if the hIgnoreIntegrity and hCheckIntegrity constants are used at the same time.
| hRecalculateIdAuto | Mode for calculating the automatic identifier: The automatic identifier of the record will be re-calculated during the write operation. This constant has priority over hForceIdAuto and hSetIdAuto.
| hCheckDuplicates | Management mode of duplicates: Checks the duplicates for this operation, even if the check for duplicates is disabled (HSetDuplicates). A WLanguage error occurs if the hIgnoreDuplicates and hCheckDuplicates constants are used at the same time.
| hCheckIntegrity | Management mode of integrity: Checks the integrity of operation even if the automatic integrity check is disabled (HSetIntegrity). A WLanguage error occurs if the hIgnoreIntegrity and hCheckIntegrity constants are used at the same time.
|
Remarks Managing the duplicates and the integrity The integrity check and the duplicate check are performed on the keys for which: - a check is enabled,
and - the value of the item is modified in relation to the record found in the data file.
Example:
... Customer.LastName = "TUBE" Customer.FirstName = "Milo" HAdd(Customer) // integrity and duplicate check performed on // LastName and FirstName if active management Customer.FirstName = "Mark" HModify(Customer) // integrity and duplicate check performed on // FirstName only if active management ...
Business / UI classification : Business Logic
This page is also available for…
|
|
|
| |
| Cambio de ID o Primary Key |
|
| Como puedo cambiar una llave primaria con hmodify, le asigno el valor manualmente pero no se afecta al guardar. |
|
|
|
| |
| |
| |
| |
| |
| |
| | |
|