ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / HFSQL / HFSQL functions
  • Example: Creating a view
  • Example: Creating a view with a condition on a Numeric variable
  • Example: Creating a view with a condition on a Character String variable
  • Example: Performing a search on a composite key in a view
HCreateView (Example)
Example: Creating a view
The following example is used to create a view and to read the records found in the view. These records are displayed in a trace window.
View1 is Data Source
// Create view
IF HCreateView(View1, Category, "*", "", "Caption>='B'", hViewAdd) = False THEN
Error(HErrorInfo())
END
// Browse view
HReadFirst(View1)
WHILE NOT HOut()
// Read the caption item of View1
Trace(View1.Caption)
HReadNext(View1)
END
HDeleteView(View1)
Example: Creating a view with a condition on a Numeric variable
The following example is used to create a view with a condition on a Numeric variable.
EXTERN MyView
// Create view
IF HCreateView("MyView", FileName, "*", "", ...
"ItemName =" + VariableName, hViewDefault) = False THEN
  Error(HErrorInfo())
END
// Browse view
HReadFirst(MyView)
WHILE NOT HOut()
  // Process to insert
    HReadNext(MyView)
END
Example: Creating a view with a condition on a Character String variable
WEBDEV - Server codeReports and QueriesUser code (UMC)AjaxHFSQL ClassicHFSQL Client/ServerHyper File 5.5OLE DBNative Connectors (Native Accesses) The following example is used to create a view with a condition on a Character String variable.
EXTERN MyView
// Create view
IF NOT HCreateView("MyView", FileName, "*", "", ...
"ItemName =" + VariableName + "", hViewDefault)  THEN
Error(HErrorInfo())
END
 
// Browse view
HReadFirst(MyView)
WHILE NOT HOut()
    // Process to insert
    HReadNext(MyView)
END
Example: Performing a search on a composite key in a view
WINDEVWEBDEV - Server codeUser code (UMC)AjaxHFSQL ClassicHFSQL Client/ServerHyper File 5.5OLE DBNative Connectors (Native Accesses) The following example is used to create a view and to perform a search on a composite key found in the view.
// Create view
MyView is Data Source
HourGlass()
HCreateView(MyView, Cedex, "*", "", "", hViewDefault)
// Search
HReadSeekFirst(MyView, "CityZipCode", ...
HBuildKeyValue(Cedex, CityZipCode, "75000", "PARIS"))
HourGlass(False)
IF HFound() = True THEN
    Info("Record found")
    Trace(MyView.city + " " + MyView.ZipCode)
ELSE
    Info("Record not found")
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help