ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / HFSQL / HFSQL functions
  • Management of duplicates enabled
  • Generalizing the check for duplicates
  • Disabling the check for duplicates
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
HSetDuplicates (Function)
In french: HGèreDoublon
HFSQL ClassicHFSQL Client/ServerAvailable only with these kinds of connection
Enables or disables the management of duplicates on a unique key.
Remarks:
  • The management of duplicates is enabled by default.
  • This function is not available on databases accessed by OLE DB or by Native Connectors (also called Native Accesses).
Example
// Disable the management of duplicates on the Customer data file for the "Name" key
HSetDuplicates(Customer, Name, False)
Syntax
<Result> = HSetDuplicates([<Data file> [, <Key item>, ]] <Activation>)
<Result>: Boolean
Former management mode of duplicates (before the call to HSetDuplicates):
  • True if the management of duplicates was enabled,
  • False if the management of duplicates was disabled (or if the specified key is a key with duplicates).
If <Key item> = "*", <Result> is set to True if the check for duplicates was enabled for at least one item in the former management mode of duplicates.
<Data file>: Optional character string
Name of the data file used.
If this parameter is not specified or corresponds to "*", the management of duplicates is taken into account for all the data files of the analysis.
<Key item>: Optional character string
Name of unique key item used.
If this parameter is not specified or if it corresponds to "*", the management of duplicates is taken into account for all the key items in the specified data file.
<Activation>: Boolean
Management mode:
  • True if the management of duplicates must be enabled on the item,
  • False if this management must be disabled.
If only this parameter is specified, the management mode is applied to all the items of all the data files.
Remarks

Management of duplicates enabled

If the management of duplicates is enabled on a key defined as unique key, the uniqueness is automatically checked whenever a record is added or modified in the data file.
Therefore, if the uniqueness is not checked during an addition (HAdd) or a modification (HModify), the record is not added/modified, the addition/modification function returns an error and HErrorDuplicates returns True.
Remark: Only HAdd and HModify can generate a duplicate error.

Generalizing the check for duplicates

  • To generalize the management mode of duplicates to all the items found in a data file, use the meta-character "*".
    For example:
    HSetDuplicates(<Data file>, "*", <Activation>)
  • To generalize the management mode of duplicates to all the items found in all the data files, you must use the meta-character "*".
    For example:
    HSetDuplicates("*", "*", <Activation>)
  • If only <Activation> is specified, the management mode is applied to all data files and items.

Disabling the check for duplicates

Disabling the check for duplicates means the possibility not to comply with the uniqueness rules specified during the description of the data files in the data model editor. Therefore, disabling the check for duplicates must be done with great care: it must be used advisedly.
Component: wd290hf.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help