PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Example: Creating a file made of 3 items including a composite key
KeyExpression (Example)
Example: Creating a file made of 3 items including a composite key
WINDEVWEBDEV - Server codeWindowsWindows MobileAjax This example is used to create by programming a file containing two simple items and a composite key.
Once the file is created, it is filled and a search is performed on 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)
HCreation(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
This page is also available for…
Comments
Click [Add] to post a comment