PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Example 1: Describing a data file by programming
  • Example 2: Creating a data file by programming made of 3 items (one of them being a composite key)
HDescribeItem (Example)
Example 1: Describing a data file by programming
WINDEVWEBDEV - Server codeReports and QueriesWindows MobileAjaxUser code (UMC)HFSQLStored proceduresOLE DBNative Connectors (Native Accesses)
The following example is used to describe a data file by programming with its links, items, ....
AFile is File Description
AnItem is Item Description
 
// Describe the "CUSTOMER" file
AFile..Name = "CUSTOMER"
AFile..Type = hFileNormal
AFile..FicCryptMethod = hCryptStandard
 
// Describe the "LASTNAME" item
AnItem..Name = "LASTNAME"
AnItem..Type = hItemText
AnItem..Size = 40
AnItem..KeyType = hUniqueKey
HDescribeItem(AFile, AnItem)
 
// Describe the "FIRSTNAME" item
AnItem..Name = "FIRSTNAME"
AnItem..Type = hItemText
AnItem..Size = 40
HDescribeItem(AFile, AnItem)
 
// Validates the file description
HDescribeFile(AFile)
Example 2: Creating a data file by programming made of 3 items (one of them being a composite key)
WINDEVWEBDEV - Server codeReports and QueriesWindows MobileUser code (UMC)HFSQLStored procedures
This example is used to create a data file by 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
 
MyFile is File Description
MyItem1 is Item Description
MyItem2 is Item Description
CompositeKey is Item Description
 
// Declare the file
MyFile..Name = "Temp_File"
MyFile..Type = hFileNormal
 
// Declare the item 1
MyItem1..Name = "ITM1"
MyItem1..Type = hItemText
MyItem1..Size = 20
HDescribeItem(MyFile, MyItem1)
 
// Declare the item 2
MyItem2..Name="ITEM2"
MyItem2..Type = hItemText
MyItem2..Size = 20
HDescribeItem(MyFile, MyItem2)
 
// Declare the composite key
CompositeKey..Name = "CompItem"
CompositeKey..KeyExpression="ITEM1+ITEM2"
 
HDescribeItem(MyFile, CompositeKey)
 
HDescribeFile(MyFile)
 
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