PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Declaring a Record variable
  • Accessing the items
  • Reading and assigning a Record variable
  • Special cases
  • Functions that handle the Record type
  • Properties specific to the description of Record variables
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
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.
Use examples: This allows you to store in different variables the content of several records in order to compare them or to compare some items.
Versions 23 and later
iPhone/iPad This type of variable is now available for the iPhone/iPad applications.
Android This type of variable is now available for the Android applications.
Android Widget This type of variable is now available in Android Widget mode.
New in version 23
iPhone/iPad This type of variable is now available for the iPhone/iPad applications.
Android This type of variable is now available for the Android applications.
Android Widget This type of variable is now available in Android Widget mode.
iPhone/iPad This type of variable is now available for the iPhone/iPad applications.
Android This type of variable is now available for the Android applications.
Android Widget This type of variable is now available in Android Widget mode.
Example
CustomerRec is Record of CUSTOMER

HReadFirst(CUSTOMER, CUSTNUM)
IF NOT HOut() THEN
CustomerRec = CUSTOMER
// Display the last and first names of the customer
Info(CustomerRec.LASTNAME, CustomerRec.FIRSTNAME)
END
CustomerRec is Record of CUSTOMER

CustomerRec.LastName = "MOORE"
CustomerRec.FirstName = "Paul"
CustomerRec.City = "PARIS"

// Assigns the content of the CustomerRec variable in the buffer of CUSTOMER file
CUSTOMER = CustomerRec  

HAdd(CUSTOMER)

// You have the ability to do: HAdd(CUSTOMER, CustomerRec)
Remarks

Declaring a Record variable

The following syntax is used to declare a Record variable:
<Variable Name> is Record [of <Name of Analysis File>]
  • If <Name of Analysis File> is specified, the record is associated with a description of one of the data files found in the analysis. In this case, you have the ability to handle the different record items.
  • If <Name of Analysis File> is not specified, the structure of the record will be built dynamically according to the buffer of the file that is 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:
    <Variable Name>.<Item Name> = <Value to Assign>
  • To retrieve the value of the items:
    <Value> = <Variable Name>.<Item Name>
Note: When using a record variable associated with a data file of the analysis, the code editor automatically proposes the different record items:

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:
    <Name of Record Variable> = <Name of Data File>
  • To assign the buffer of a data file from a Record variable:
    <Name of Data File> = <Name of Record Variable>

Special cases

  • HRetrieveRecord 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 file. An homonymic copy of buffers is performed: only the items with the same name of each buffer will be assigned. The other items will be not assigned.
  • Only the JSON serialization is available for this type of variable (Serialize). No deserialization is possible.

Functions that handle the Record type

The following functions use the Record type:
Versions 09 and later
HAdd
New in version 09
HAdd
HAdd
Adds
  • 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).
Versions 09 and later
HCopyRecord
New in version 09
HCopyRecord
HCopyRecord
Copies
  • the content of current record (loaded in memory) into the current record of a data file.
  • the content of Record variable into the current record of a data file.
Versions 09 and later
HExtractMemo
New in version 09
HExtractMemo
HExtractMemo
Extracts the content of a binary memo item from a HFSQL file, a query or a HFSQL view into a physical file (on disk).
Versions 09 and later
HInfoMemo
New in version 09
HInfoMemo
HInfoMemo
Returns the characteristics of binary and text memos.
Versions 09 and later
HLinkMemo
New in version 09
HLinkMemo
HLinkMemo
Used to associate a file with a binary memo item or to cancel the existing link between a file and a binary item.
Versions 09 and later
HListItem
New in version 09
HListItem
HListItem
Returns 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
Versions 09 and later
HReset
New in version 09
HReset
HReset
Initializes
  • one or all variables of file items with their default values
  • one or all items of a Record variable with their default values
Versions 09 and later
HRetrieveRecord
New in version 09
HRetrieveRecord
HRetrieveRecord
Returns the content of the current record (in a file, a view or a query, ...).
Note: To reinitialize the content of a Record variable, you have the ability to use VariableReset.

Properties specific to the description of Record variables

The following properties can be used to find out the characteristics of a Record variable:
Property nameType usedEffect
ContentCharacter stringContent of the current record (identical to the result returned by HRetrieveRecord).
This property is available in read-only.
AssociatedFileCharacter stringName of the HFSQL file on which the variable is based.
This property is available in read-only.
Note: These properties can be used with one of the following syntaxes:
  • <Variable Name>..<Property Name>
  • <Variable Name>.<Property Name>
Minimum required version
  • Version 19
This page is also available for…
Comments
Click [Add] to post a comment