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)
HFSQL Classic This example is used to create through programming a data file containing 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
MyItem3 is Item Description
MyCompositeKey is Item Description
 
// Declaration of the data 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 item 3
MyItem3.Name = "Item3"
MyItem3.Type = hItemHour
MyItem3.Size = 6 // HHMMSS format
HDescribeItem(MyFile1, MyItem3)
 
// 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 11
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/14/2024

Send a report | Local help