PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • The copied values
  • Using the lists of items
  • Array items
  • Errors that do not modify the Destination record
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
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 codeWindows Mobile the content of Record variable into the current file record.
    New in version 19
    WINDEVWEBDEV - Server codeWindows Mobile the content of Record variable into the current file record.
    WINDEVWEBDEV - Server codeWindows Mobile the content of Record variable into the current file record.
The source data file and the destination data file do not necessarily have the same structure. Only the stored data of the 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 the Android applications.
New in version 15
Android This function is now available for the Android applications.
Android This function is now available for the Android applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps 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.
Note: From version 19, HFSQL is the new name of HyperFileSQL.
HReadFirst(CUSTOMER, NAME)
WHILE HOut(CUSTOMER) = False
// Adds the record into the CUSTOMER2 file
HCopyRecord(CUSTOMER2, CUSTOMER, hDefaultVal)
HAdd(CUSTOMER2)
// Goes to the next record
HReadNext(CUSTOMER, NAME)
END
// Copy the records found in the ORDERS file into an archive file
ORDERS_2009 is Data Source

// Create the archive file
HAlias(ORDERS, ORDERS_2009)
HChangeName(ORDERS_2009, "ORDERS_2009")
HCreation(ORDERS_2009)

// Archive the orders
FOR EACH ORDERS WHERE OrderDate = "20090101" TO "20091231"
// Adds the record into the archive file
HCopyRecord(ORDERS_2009, ORDERS, hDefaultVal)
HAdd(ORDERS_2009)
END
Syntax

Copying the current record Hide the details

<Result> = HCopyRecord(<Name of Destination File>, <Name of Source File> [, <Name of Destination Item> [, <Name of Source Item>]] [, <Options>])
<Result>: Boolean
  • True if the copy was performed,
  • False if an error occurred. HError is used to identify the error.
<Name of Destination File>: Character string (with or without quotes)
Name of destination data file to use. The data will be copied into the current record of this data file.
<Name of Source File>: Character string (with or without quotes)
Name of source data file to use. The current record of this data file contains the information that must be copied.
<Name of Destination Item>: Optional character string (with quotes)
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).
Note: The composite keys cannot be defined as destination items. They will be automatically assigned.
Hyper File 5.5 This parameter is ignored.
<Name of Source Item>: Optional character string (with quotes)
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.
Note: The use of this constant requires the use of the hSetIdAuto constant during the next call to 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 codeWindows Mobile

Copying the record found in a Record variable Hide the details

<Result> = HCopyRecord(<Name of Destination File>, <Source Record> [, <Name of Destination Item> [, <Name of Source Item>]] [, <Options>])
<Result>: Boolean
  • True if the copy was performed,
  • False if an error occurred. HError is used to identify the error.
<Name of Destination File>: Character string (with or without quotes)
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.
<Name of Destination Item>: Optional character string (with quotes)
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).
Note: The composite keys cannot be defined as destination items. They will be automatically assigned.
Hyper File 5.5 This parameter is ignored.
<Name of Source Item>: Optional character string (with quotes)
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.
Note: The use of this constant requires the use of the hSetIdAuto constant during the next call to 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 codeWindows Mobile

Copying the record found in a Record variable Hide the details

<Result> = HCopyRecord(<Name of Destination File>, <Source Record> [, <Name of Destination Item> [, <Name of Source Item>]] [, <Options>])
<Result>: Boolean
  • True if the copy was performed,
  • False if an error occurred. HError is used to identify the error.
<Name of Destination File>: Character string (with or without quotes)
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.
<Name of Destination Item>: Optional character string (with quotes)
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).
Note: The composite keys cannot be defined as destination items. They will be automatically assigned.
Hyper File 5.5 This parameter is ignored.
<Name of Source Item>: Optional character string (with quotes)
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.
Note: The use of this constant requires the use of the hSetIdAuto constant during the next call to 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 codeWindows Mobile

Copying the record found in a Record variable Hide the details

<Result> = HCopyRecord(<Name of Destination File>, <Source Record> [, <Name of Destination Item> [, <Name of Source Item>]] [, <Options>])
<Result>: Boolean
  • True if the copy was performed,
  • False if an error occurred. HError is used to identify the error.
<Name of Destination File>: Character string (with or without quotes)
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.
<Name of Destination Item>: Optional character string (with quotes)
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).
Note: The composite keys cannot be defined as destination items. They will be automatically assigned.
Hyper File 5.5 This parameter is ignored.
<Name of Source Item>: Optional character string (with quotes)
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.
Note: The use of this constant requires the use of the hSetIdAuto constant during the next call to 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.
Note: 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 target items (<Name of Target Items>) is specified, only the specified items will be copied.
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppJavaUser code (UMC)HFSQLHFSQL Client/ServerStored proceduresHyper File 5.5OLE DBNative Accesses

Array items

When handling the array items, HCopyRecord copies the maximum number of elements (starting from the first one).
If the array of the "source" record contains more elements than the array of the "target" 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 "target" record, the additional elements of the "target" record are not modified, except if the hDefaultVal constant is specified.

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 target items contains a name of "composite key" item
  • the list of target items contains a name of "automatic identifier" item while the hCopyAutoId constant is not specified.
  • two lists of different sizes are specified.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230hf.dll
Windows Mobile wp230hf.dll
Java wd230java.jar
Linux wd230hf.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment