AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Administrar bases de datos / HFSQL / Funciones HFSQL
  • The copied values
  • Using the lists of items
  • Array items
  • Errors that do not modify the destination record
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
HCopyRecord (Function)
ODBCNo disponible con este tipo de conexión
Copies:
  • the content of the current record (loaded in memory) to the current data file record.
  • 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.
HReadFirst(Customer, Name)
WHILE HOut(Customer) = False
	// Adds the record to the data file Customer2
	HCopyRecord(Customer2, Customer, hDefaultVal)
	HAdd(Customer2)
	// Goes to the next record
	HReadNext(Customer, Name)
END
// Copy records from the Orders data file to an archive file
Orders_2019 is Data Source

// Create the archive file
HAlias(Order, Orders_2019)
HChangeName(Orders_2019, "Orders_2019")
HCreation(Orders_2019)

// Archive the orders
FOR EACH Orders where OrderDate = "20190101" TO "20191231"
	// Adds the record to the archive file
	HCopyRecord(Orders_2019, Orders, hDefaultVal)
	HAdd(Orders_2019)
END
Sintaxis

Copying the current record Ocultar los detalles

<Result> = HCopyRecord(<Destination data file> , <Source data file> [, <Destination item> [, <Source item>]] [, <Options>])
<Result>: Boolean
  • True if the image was copied,
  • False if an error occurs. 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).
Note: Compound keys cannot be destination fields. 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.
Note The use of this constant implies the use of the constant hFixeIDAuto in the following HAdd function.
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.
Observaciones

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 assignments are made between fields of different types, type conversions conform to those of WLanguage.

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 handling 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 "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.

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 data file items 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.
Clasificación Lógica de negocio / UI: Lógica de negocio
Componente: wd300hf.dll
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local