ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage properties / Various properties
  • Example: Creating a data file through programming made of 3 items (one of them being a composite key)
Example: Creating a data file through programming made of 3 items (one of them being a composite key)
WINDEVWEBDEV - Server codeWindowsAjaxHFSQL Classic This example is used to create a data file through programming. This data file contains two simple items and a composite key.
Once the data file is created, it is filled with data and a search is performed the composite key.
EXTERN Temp_File
EXTERN Item1
EXTERN Item2
EXTERN CompItem

MyFile1 is File Description
MyItem1 is Item Description
MyItem2 is Item Description
MyCompositeKey is Item Description

// Declare the file
MyFile1.Name = "Temp_File"
MyFile1.Type = hFileNormal

// Declare the item 1
MyItem1.Name = "Item1"
MyItem1.Type = hItemText
MyItem1.Size = 20
HDescribeItem(MyFile1, MyItem1)

// Declare the item 2
MyItem2.Name = "Item2"
MyItem2.Type = hItemText
MyItem2.Size = 20
HDescribeItem(MyFile1, MyItem2)

// Declare the composite key
MyCompositeKey.Name = "CompItem"
MyCompositeKey.KeyExpression = "Item1+Item2"
HDescribeItem(MyFile1, MyCompositeKey)

HDescribeFile(MyFile1)
HCreate(Temp_File)

Temp_File.Item1 = "Montpellier"
Temp_File.Item2 = "Paris"
HAdd(Temp_File)

Temp_File.Item1 = "Marseille"
Temp_File.Item2 = "Lyon"
HAdd(Temp_File)

HReadSeek(Temp_File, CompItem, HBuildKeyValue(Temp_File, CompItem, "Marseille", "Lyon"))
IF HFound() = True THEN
	Trace(Temp_File.Item1, Temp_File.Item2)
END
Minimum version required
  • Version 9
Comments
Click [Add] to post a comment

Last update: 06/14/2024

Send a report | Local help