PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN

This content has been translated automatically. Click here to view the French version.
  • The copied values
  • Using the lists of items
  • Array items
  • Errors that do not modify the destination record
  • Previous versions
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
HCopyRecord (Function)
In french: HCopieEnreg
ODBCNot available with this kind of connection
Copies:
  • the content of current record (loaded in memory) into the current record of a data file.
  • Versions 19 and later
    WINDEVWEBDEV - Server codeAndroidAndroid Widget Java the contents of a variable of type Record in the current record of a data file.
    New in version 19
    WINDEVWEBDEV - Server codeAndroidAndroid Widget Java the contents of a variable of type Record in the current record of a data file.
    WINDEVWEBDEV - Server codeAndroidAndroid Widget Java the contents of a variable of type Record in the current record of a data file. The source data file and the destination data file do not necessarily have the same structure. Only the stored data of destination data file is modified. The destination data file will be modified when saving the current record.
Versions 15 and later
Android This function is now available for Android applications.
New in version 15
Android This function is now available for Android applications.
Android This function is now available for Android applications.
Versions 17 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android widget mode.
New in version 18
Android Widget This function is now available in Android widget mode.
Android Widget This function is now available in Android widget mode.
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.
Versions 26 and later
AndroidAndroid Widget Java The syntax for handling a variable of type Record is now available.
New in version 26
AndroidAndroid Widget Java The syntax for handling a variable of type Record is now available.
AndroidAndroid Widget Java The syntax for handling a variable of type Record is now available.
Remark: From version 19, HFSQL is the new name of HyperFileSQL.
HReadFirst(Client, Nom)
WHILE HOut(Client) = False
// Ajoute l'enregistrement dans le fichier de données Client2
HCopyRecord(Client2, Client, hDefaultVal)
HAdd(Client2)
// Passe à l'enregistrement suivant
HReadNext(Client, Nom)
END
// Copie des enregistrements du fichier de données Commande dans un fichier d'archive
Commande_2019 is Data Source
 
// Création du fichier d'archive
HAlias(Commande, Commande_2019)
HChangeName(Commande_2019, "Commande_2019")
HCréation(Commande_2019)
 
// Archivage des commandes
FOR EACH Commande where DateCommande = "20190101" TO "20191231"
// Ajoute l'enregistrement dans le fichier d'archive
HCopyRecord(Commande_2019, Commande, hDefaultVal)
HAdd(Commande_2019)
END
Syntax

Copying the current record Hide the details

<Result> = HCopyRecord(<Destination data file> , <Source data file> [, <Destination item> [, <Source item>]] [, <Options>])
<Result>: Boolean
  • True if the copy was performed,
  • False if an error occurred. HError is used to identify the error.
<Destination data file>: Character string
Name of destination data file to use. The data will be copied into the current record of this data file.
<Source data file>: Character string
Name of source data file to use. The current record of this data file contains the information that must be copied.
<Destination item>: Optional character string
List of items found in the destination data file that must be assigned with the values read in the current record of source data file. The items must be separated by a comma or by a CR character (Carriage Return).
Remark: The composite keys cannot be defined as destination items. They will be automatically assigned.
Hyper File 5.5 This parameter is ignored.
<Source item>: Optional character string
List of items found in the source data file that must be copied into the current record of destination data file. The items must be separated by a comma or by a CR character (Carriage Return). These items must be classified according to the order in which they will be assigned in the destination items. The composite keys must be excluded from this list.
Hyper File 5.5 This parameter is ignored.
<Options>: Constant or combination of constants (optional)
Configures the copy:
hCopyAutoIdCopies the automatic identifier while keeping its value.
Remark: The use of this constant implies the use of the constant hSetIdAuto in the following function HAdd.
hDefaultValThe items of destination record that are not affected by the copy are initialized with their default value (defined in the data model editor).

If no parameter is specified, the automatic identifier is not copied and the unmodified items of destination record are not initialized.
Hyper File 5.5 This parameter is ignored.
Versions 19 and later
WINDEVWEBDEV - Server codeAndroidAndroid Widget Java

Copying the record found in a Record variable Hide the details

<Result> = HCopyRecord(<Destination data file> , <Source record> [, <Destination item> [, <Source item>]] [, <Options>])
<Result>: Boolean
  • True if the copy was performed,
  • False if an error occurred. HError is used to identify the error.
<Destination data file>: Character string
Name of destination data file to use. The data will be copied into the current record of this data file.
<Source record>: Record variable
Name of Record variable containing the information to copy.
<Destination item>: Optional character string
List of items found in the destination data file that must be assigned with the values read in the current record of source data file. The items must be separated by a comma or by a CR character (Carriage Return).
Remark: The composite keys cannot be defined as destination items. They will be automatically assigned.
Hyper File 5.5 This parameter is ignored.
<Source item>: Optional character string
List of items found in the source data file that must be copied into the current record of destination data file. The items must be separated by a comma or by a CR character (Carriage Return). These items must be classified according to the order in which they will be assigned in the destination items. The composite keys must be excluded from this list.
Hyper File 5.5 This parameter is ignored.
<Options>: Constant or combination of constants (optional)
Configures the copy:
hCopyAutoIdCopies the automatic identifier while keeping its value.
Remark: The use of this constant implies the use of the constant hSetIdAuto in the following function HAdd.
hDefaultValThe items of destination record that are not affected by the copy are initialized with their default value (defined in the data model editor).

If no parameter is specified, the automatic identifier is not copied and the unmodified items of destination record are not initialized.
Hyper File 5.5 This parameter is ignored.
New in version 19
WINDEVWEBDEV - Server codeAndroidAndroid Widget Java

Copying the record found in a Record variable Hide the details

<Result> = HCopyRecord(<Destination data file> , <Source record> [, <Destination item> [, <Source item>]] [, <Options>])
<Result>: Boolean
  • True if the copy was performed,
  • False if an error occurred. HError is used to identify the error.
<Destination data file>: Character string
Name of destination data file to use. The data will be copied into the current record of this data file.
<Source record>: Record variable
Name of Record variable containing the information to copy.
<Destination item>: Optional character string
List of items found in the destination data file that must be assigned with the values read in the current record of source data file. The items must be separated by a comma or by a CR character (Carriage Return).
Remark: The composite keys cannot be defined as destination items. They will be automatically assigned.
Hyper File 5.5 This parameter is ignored.
<Source item>: Optional character string
List of items found in the source data file that must be copied into the current record of destination data file. The items must be separated by a comma or by a CR character (Carriage Return). These items must be classified according to the order in which they will be assigned in the destination items. The composite keys must be excluded from this list.
Hyper File 5.5 This parameter is ignored.
<Options>: Constant or combination of constants (optional)
Configures the copy:
hCopyAutoIdCopies the automatic identifier while keeping its value.
Remark: The use of this constant implies the use of the constant hSetIdAuto in the following function HAdd.
hDefaultValThe items of destination record that are not affected by the copy are initialized with their default value (defined in the data model editor).

If no parameter is specified, the automatic identifier is not copied and the unmodified items of destination record are not initialized.
Hyper File 5.5 This parameter is ignored.
WINDEVWEBDEV - Server codeAndroidAndroid Widget Java

Copying the record found in a Record variable Hide the details

<Result> = HCopyRecord(<Destination data file> , <Source record> [, <Destination item> [, <Source item>]] [, <Options>])
<Result>: Boolean
  • True if the copy was performed,
  • False if an error occurred. HError is used to identify the error.
<Destination data file>: Character string
Name of destination data file to use. The data will be copied into the current record of this data file.
<Source record>: Record variable
Name of Record variable containing the information to copy.
<Destination item>: Optional character string
List of items found in the destination data file that must be assigned with the values read in the current record of source data file. The items must be separated by a comma or by a CR character (Carriage Return).
Remark: The composite keys cannot be defined as destination items. They will be automatically assigned.
Hyper File 5.5 This parameter is ignored.
<Source item>: Optional character string
List of items found in the source data file that must be copied into the current record of destination data file. The items must be separated by a comma or by a CR character (Carriage Return). These items must be classified according to the order in which they will be assigned in the destination items. The composite keys must be excluded from this list.
Hyper File 5.5 This parameter is ignored.
<Options>: Constant or combination of constants (optional)
Configures the copy:
hCopyAutoIdCopies the automatic identifier while keeping its value.
Remark: The use of this constant implies the use of the constant hSetIdAuto in the following function HAdd.
hDefaultValThe items of destination record that are not affected by the copy are initialized with their default value (defined in the data model editor).

If no parameter is specified, the automatic identifier is not copied and the unmodified items of destination record are not initialized.
Hyper File 5.5 This parameter is ignored.
Remarks

The copied values

The items whose name is common to both records are copied (and converted if necessary).
The items of the source record that do not exist in the destination record are not copied.
The items of the destination record that do not exist in the source record are not modified (except if the hDefaultVal constant is specified).
When copying an item whose value is NULL, the copied item is initialized to empty (empty string ("") for the strings and 0 for the numeric values) if the NULL value is not supported by the destination data file.
Remark: When the assignments are performed between different types of items, the type conversions follow the WLanguage standards.

Using the lists of items

Specifying two lists of items allows you to assign items with different names. The items are assigned in the order in which they appear in the lists.
If none of the two lists of items is supplied, only the items whose name is common to both records are copied.
If only the list of the destination items (<Destination item>) is specified, only the specified items will be copied.

Array items

When manipulating arrays fields, function HCopyRecord copy the maximum number of elements starting with the first element.
If the array of the "source" record contains more elements than the array of the "destination" record, the additional elements of the "source" record are not copied.
If the array of the "source" record contains less elements than the array of the "destination" record, the additional elements of the "destination" record are not modified, except if the hDefaultVal constant is specified.
AndroidAndroid Widget Feature not available.

Errors that do not modify the destination record

The following errors do not modify the destination record:
  • no list is supplied and no item name is common to the two data files.
  • the list of items of a data file contains an item name that does not exist this data file.
  • the list of destination items contains a name of "composite key" item.
  • the list of destination items contains a name of "automatic identifier" item while the hCopyAutoId constant is not specified.
  • two lists of different sizes are specified.
WINDEV

Previous versions

This function replaces the function HCopieEnreg_55, kept for compatibility with WINDEV 5.5.
Business / UI classification: Business Logic
Component: wd270hf.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment