ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / Managing databases / HFSQL / Types of HFSQL variables
  • Declaring a Record variable
  • Accessing the items
  • Reading and assigning a Record variable
  • Special cases
  • Properties specific to Record variables
  • Functions that use the Record type
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
The Record type is used to handle (modify, save, ...) the values of a record. This record can be a record found in a data file, a query or a view. The variable associated with the Record type will be structured like a record of the database.
Examples of use: In this way, you can store the contents of different records in different variables to compare them or to compare certain items..
Example
// CLIENT est un fichier de données décrit dans l'analyse
EnregClient is Record of CLIENT

HReadFirst(CLIENT, NUMCLI)
IF NOT HOut() THEN
	EnregClient = CLIENT
	// Affichage du nom et prénom du client 
	Info(EnregClient.NOM, EnregClient.PRENOM)
END
// CLIENT est un fichier de données décrit dans l'analyse
EnregClient is Record of CLIENT

EnregClient.Nom = "DUPONT"
EnregClient.Prénom = "Paul"
EnregClient.Ville = "MONTPELLIER"

// Affecte le contenu de la variable EnregClient dans le buffer du fichier de données Client
CLIENT = EnregClient  

HAdd(CLIENT)

// Il est également possible de faire : HAjoute(CLIENT, EnregClient)
Remarks

Declaring a Record variable

The following syntax is used to declare a Record variable:
<Nom de la variable> est un Enregistrement [de <Nom du fichier de données dans l'analyse>]
  • If <Name of data file in the analysis> is specified, the record is associated with a description of one of the data files in the analysis. In this case, you have the ability to handle the different record items.
  • If <Name of data file in the analysis> is not specified, the structure of the record will be built dynamically according to the buffer of the file allocated to it.

Accessing the items

To access the items of a Record variable, use the following syntax:
  • To assign an item of the variable:
    <Nom Variable>.<Nom rubrique> = <Valeur à affecter>
  • To retrieve the value of the items:
    <Valeur> = <Nom Variable>.<Nom rubrique>
Note: When using an Record variable associated with an analysis data file, the code editor automatically proposes the various record headings:

Reading and assigning a Record variable

A Record variable can be read or assigned. The syntax is as follows:
  • To store the buffer of a data file in a Record variable:
    <Nom de la variable Enregistrement> = <Nom du fichier de données>
  • To assign the buffer of a data file from a Record variable:
    <Nom du fichier de données> = <Nom de la variable Enregistrement>
Note: assigning a variable of type Record to a data file modifies property NewRecord.

Special cases

  • HRecordToString used on a Record variable returns a character string containing the value of each item separated by a TAB character.
  • No compilation error occurs if a Record variable with type on a data file is assigned with the buffer of another data file. Buffers are copied homonymously: only fields of the same name in each buffer are assigned.. The other items will be not assigned.
  • Only JSON serialization is available for this type of variable (Serialize). No deserialization is possible.

Properties specific to Record variables

The following properties can be used to find out the characteristics of a Record variable:
Property nameType usedEffect
AssociatedFileCharacter stringName of the HFSQL data file on which the variable is based.
This property is read-only.
ContentCharacter stringContent of the current record (identical to the result returned by HRecordToString).
This property is read-only.

Functions that use the Record type

The following functions use the Record type:
HAddAdds:
  • the record found in memory into the data file (query or view).
  • the record found in a Record variable into the data file (query or view).
HCopyRecordCopies:
  • the content of the current record (loaded in memory) to the current data file record.
  • the content of the Record variable to the current data file record.
HExtractMemoExtracts the content of a binary memo item from an HFSQL file, a query or an HFSQL view to a physical file (on disk).
HInfoMemoReturns the characteristics of binary and text memos.
HLinkMemoUsed to associate a file with a binary memo item or to cancel the existing link between a file and a binary item.
HListItemReturns the list of items:
  • found in a data file ( a query or a view) known to the HFSQL engine. The data files defined by HDeclare, HDeclareExternal and HDescribeFile are taken into account.
  • found in a Record variable.
HRecordToStringConverts the content of the current record to string (in a data file, HFSQL view, query, etc.).
HResetInitializes:
  • one or all variables of file items with their default values.
  • one or all items of a Record variable with their default values.
Note: To reset the contents of an Recordvariable, you can also use the VariableReset function.
Minimum version required
  • Version 19
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/20/2024

Send a report | Local help