ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / HFSQL / Types of HFSQL variables
  • Properties specific to link descriptions
  • How to describe data files programmatically?
  • Handling the links of a data file described through programming
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
A Link Description variable is used to describe a link between two data files through programming. The description of each link is validated by HDescribeLink.
After this validation:
  • This link can be handled like any other link described in the analysis.
  • The "Link Description" variable is reinitialized and can be used to describe another link through programming.
Remark: To add a relationship to an HFSQL Client/Server database, use HAddLink.
Example
MyLink is Link Description
MyLink1, MyLink2 are Link Descriptions
// Describe and validate City and Customer data files
...
 
// Describe the "LIVES" link
MyLink is Link Description
MyLink.Name = "LIVES"
MyLink.SourceFile = "CITY"
MyLink.LinkedFile = "CUSTOMER"
MyLink.SourceKey = "CITYNAME"
MyLink.LinkedKey = "CUSTCITY"
// Default link (0-1, 0-1)
 
// Validate the description of the "LIVES" link
HDescribeLink(MyLink)
Syntax

Declaring one or more link descriptions Hide the details

<Variable name> is Link Description
<Variable name 1>, <Variable name 2> are Link Descriptions
<Variable name>:
Name of the "Link Description" variable to be declared.
Remark: The a and an keywords are optional: they provide better readability.

Describing a "Link Description" variable Hide the details

To describe a "Link Description" variable:
Use the WLanguage properties specific to link descriptions. For more details, see remarks.

To validate the description of a "Link Description" variable:
Use the HDescribeLink function.
Remarks

Properties specific to link descriptions

The following properties are specific to link descriptions:
Remark: The properties written in bold followed by a star must necessarily be initialized when a link is described by programming.
Property nameEffect
MaxLinkedCardinalityMaximum cardinality of the linked item in a link
MinLinkedCardinalityMinimum cardinality of the linked item in a link
MaxSourceCardinalityMaximum cardinality of the source item in a link
MinSourceCardinalityMinimum cardinality of the source item in a link
LinkedKey ( * )Item of the linked file used in the link
SourceKey ( * )Item of source file used in the link
LinkedFile ( * )Name of the linked file used in the link
SourceFile ( * )Name of the source file used in the link
Name ( * )Name of the link
ModificationRuleModification rule (integrity management) used in a link
DeletionRuleDeletion rule (integrity management) used in a link

By default, the cardinalities of the link are (0-1) / (0-1).

How to describe data files programmatically?

To describe data files programmatically:
  1. Declare the variables of type "File description", "Item Description", "FullTextIndex Description" and "Link Description" (if necessary).
  2. For each data file:
  3. If necessary, describe the characteristics of the links using HFSQL properties.
  4. If necessary, validate the description of each link (HDescribeLink).

Handling the links of a data file described through programming

When a link is created in the data model editor, the name of the link is automatically recognized by the compiler.
When a link is created via a "Link Description" variable, the name of this link is defined with the Name property. This name is not automatically recognized by the compiler. Using this name to identify the link generates a compilation error.
In order for the name of the link created through programming to be recognized by the compiler, this name must be declared via the Extern keyword. This link can now be handled by its name in the code editor.
For example:
MyLink is Link Description
...
MyLink.Name = "LIVES"
...
HDescribeLink("LIVES")
...
EXTERN LIVES
...
Cardinality = LIVES.MaxLinkedCardinality
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 07/06/2023

Send a report | Local help