PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Properties specific to the description of items in the code
  • How to describe data files programmatically?
  • Handling the items of a data file described programmatically
  • Logging
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
An Item Description variable is used to describe one or more items in a data file programmatically. The description of each item is validated by HDescribeItem.
After this validation:
  • This item can be handled like any other item described in the analysis.
  • The "Item Description" variable is reinitialized and can be used to describe another data file item programmatically.
Example
MyItem is Item Description
MyItem1, MyItem2 are Item Descriptions
// Describe the AFile file
...
 
// Description of the "NAME" item
MyItem is Item Description
MyItem.Name = "NAME"
MyItem.Type = hItemText
MyItem.Size = 40
MyItem.KeyType = hUniqueKey
 
// Validate the description of the "NAME" item
HDescribeItem(AFile, MyItem)
 
// Validate the description of AFile file
...
Syntax

Declaring one or more item descriptions Hide the details

<Variable name> is Item Description

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

Describing an "Item Description" variable Hide the details

To describe an "Item Description" variable:
use the WLanguage properties specific to the item descriptions. For more details, see remarks.

To validate the description of an "Item Description" variable:
use the HDescribeItem function.
Remarks

Properties specific to the description of items in the code

The following properties are specific to the item descriptions:
Remark: The properties written in bold followed by a star must necessarily be initialized when describing an item programmatically.
Property nameEffect
AccentSensitiveTake the accented characters into account when performing searches on the item
CalculatedDefaultValueDefine the SQL expression returning the default value of the item.
CalculatedItemExpressionDefine the SQL expression that returns the value of a calculated item (Expression item).
CaseSensitiveTake the case (uppercase/lowercase characters) into account when performing searches on the item
ComponentModify a component of a composite key
DecimalPartDefine the number of digits in the decimal part of a Numeric item.
DefaultValueDefault value of an item.
GDPRDetermine if the item contains GPDR-relevant data.
IntegerPartDefine the number of digits in the integer part of a Numeric item.
KeyExpressionDefine the components of a composite key.
KeySizeSize of the section to index in the text memo.
KeyTypeCharacteristics of a key item.
LanguageDefine the parameters of the language used to perform the comparisons and the sort for a Unicode item.
LanguageDescribedDefine the parameters of the language used to perform the comparisons and the sort for a Unicode item.
MaxThumbnailHeightDefine the maximum height of an item thumbnail.
MaxThumbnailWidthDefine the maximum width of an item thumbnail.
Name ( * )Name of item.
NbArrayElementNumber of elements in an array item.
NullTake the "NULL by default" option into account for the item.
NullAllowedDefine whether the NULL value is allowed (or not) for the item.
PersistedCalculatedItemDefine whether the value of a calculated item (Expression type) is stored in the data file.
PunctuationSensitiveTake the punctuation characters (comma, period, ...) into account when performing searches on the item
Size(* required depending on the specified type)Size of a text item (character string, text memo, character)
Size of a Time item.
SortTypeCharacteristics of the sort on an item.
spDerivationDefine the key derivation function used for hashing ("Password" item).
spHashDefine the algorithm used for salting ("Password" item).
spIterationCountDefine the iteration count of the hash algorithm ("Password" item).
spLengthDefining the hash output length ("Password" item).
TimestampTypeDefine the type of timestamp for the item.
TimestampUTCDefine whether the time of a timestamp item is UTC or not.
Type (* )Identifies and modifies the type of an item.
TypeDescriptionSpecify the type associated with an Enumeration or Combination item.

Special case: Describing a composite key
When describing a composite key programmatically, Type is optional. On the contrary, KeyExpression must be used to describe the composition of the composite key.
New in version 28
Special case: Describing a primary key:
  • You must indicate that the item is a primary key, using the KeyType property.
  • If the item can hold null values (NullAllowed property set to True) but can also be primary key, the NullAllowed property of the item will be automatically set to False.
Special case: Describing a Combination or Enumeration variable:
  • You must call TypeDescription to define the type used by the item.
  • It is necessary to specify the type with the Type property before specifying the default value with the DefaultValue property.
Special case: Describing a Timestamp item:
  • The item must be a DateTime, Date or Time item.
  • It is necessary to specify the timestamp type with the TimestampType property.
Special case: Describing an Expression item::
The Type property must not be used to describe an Expression item. You must use CalculatedItemExpression to describe the calculation expression.

How to describe data files programmatically?

To describe data files programmatically:
  1. For each data file:
  2. If necessary, describe the characteristics of the links using HFSQL properties.
  3. If necessary, validate the description of each link (HDescribeLink).

Handling the items of a data file described programmatically

When creating a data file in the data model editor, the names of the data files and items are automatically recognized by the compiler.
When creating a data file using a "File Description" variable, the names of the data file and its items can be defined with the Name property. These names are not automatically recognized by the compiler. A compilation error occurs if these names are used to identify the data file or the items.
To allow the compiler to recognize the names of the data file and items described in the code, the data file name must be declared as data source. Then, this data file and its items can be handled by their name in the code editor.
For example:
AFile is File Description
...
AFile.Name = "CUSTOMER"
...
HDescribeFile("CUSTOMER")
...
CUSTOMER is Data Source
...
HReadFirst(CUSTOMER, "CUSTNAME")
Remark: The name of the data file can also be declared with the Extern keyword. However, the process execution will be slower.

Logging

When the data file is described programmatically:
  • if the data file is logged and if no item is logged, all the items (except for the composite keys) are automatically logged.
  • if the data file is logged and if at least one item is logged, the other items are not modified.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment