ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / HFSQL
  • What is a view?
  • Functions for managing views
  • The WLanguage functions
  • Use
  • Handling a view
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
HFSQL views
HFSQL ClassicHFSQL Client/ServerAvailable only with these kinds of connection
Warning
From version 20, the SQL views and materialized views are available. This help page is kept for backward compatibility.
What is a view?
An HFSQL view corresponds to a "memory image" of an HFSQL data file.
A view is stored in memory, which insulates it from the modifications made to the associated data file.
Once created, a view can be handled like any HFSQL data file.
Functions for managing views

The WLanguage functions

The following functions are used to handle the HFSQL views:
HCreateViewCreates an HFSQL view.
This function uses the former view mechanism.
HDeleteViewDeletes a previously created view. This function uses the former view mechanism.
HExecuteViewRuns a view that was created beforehand (can be used to refresh the view data for example). This function uses the former view mechanism.
HMergeViewCreates an HFSQL view from two previously created views (HCreateView). This function uses the former view mechanism.
HSortViewSorts an HFSQL view by creating an index on a view item. This function uses the former view mechanism.
HViewToFileSaves the modifications performed in an HFSQL view (by HModify, HDelete or HCross) in the corresponding data file. This function uses the former view mechanism.
Use

Handling a view

Follow these operations to handle views on an HFSQL data file:
  1. Creating the view with HCreateView (while specifying the selection conditions if necessary).
  2. The view is automatically executed. The records of the view can be handled, browsed, ... by the HFSQL management functions. The name of the file specified in the functions will correspond to the name of the view.
  3. Available operations specific to views:
    • If the records in the base file of the view have been modified, you can refresh the view by executing it again (HExecuteView). You will have the ability to specify new selection criteria.
    • Modify the sort order of the records found in the view. By default, the records found in a view are sorted in the same order as the one used in the corresponding HFSQL file. However, this order can be modified by HSortView. If the sort is applied to several items of the view, the sort is applied according to the first sort item, then according to the second one, etc.
    • Apply the operations performed on the view records (add, modify, delete, etc.) to the base file of the view (HViewToFile). Caution: this operation can be performed only if the records have been locked in the file when creating the view.
    • Merge several views (HMergeView). Merging two views allows you to create a new view containing the data found in the "source" views. Then, this view can be handled like a standard view. HMergeView proposes several merge modes:
      • Union of all the rows found in the first view and in the second view.
        Caution: The structure of views must be identical.
      • Union of all the non-common rows found in the first view and in the second view.
        Caution: The structure of views must be identical.
      • Selection of the rows common to the first view and to the second view.
      • Selection of the rows found in the first view without the common rows found in the second view.
      • Merging the two views with interruption. The creation of the view can be interrupted by pressing the [ESC] key.
      • Join between the first view and the second view. The items found in the second view that do not exist in the first view (and conversely) are added into the destination view
  4. Deleting the view (HDeleteView). The deletion of a view consists in destroying everything that relates to the view, including its description. During this deletion, the records locked by the view (if they exist) are unlocked.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 07/06/2023

Send a report | Local help