PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • Selection Condition
  • Creating a view on a filtered data file
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Warning
From version 20, the SQL views and the materialized views are available.
The views handled by this function correspond to the former mechanism of views. They do not correspond to SQL views or to materialized views.
Creates a HFSQL view.
Note: To merge several views, use HMergeView.
Reminder: A HFSQL view corresponds to a "memory image" of a 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.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Universal Windows 10 App This function is now available in Windows Store apps mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Note: From version 19, HFSQL is the new name of HyperFileSQL.
// Create a view
MyView is Data Source
HCreateView(MyView, CUSTOMER, "*", "NAME,CITY", "NAME]='A'", hViewDefault)
Syntax

Creating a view on a data file (file described in the analysis or file created by programming) Hide the details

<Result> = HCreateView(<View Name> , <File Name> [, <List of items> [, <Sort Items> [, <Selection Condition>]]] [, <Creation Mode> [, <Page Size>]])
<Result>: Boolean
  • True if the view was created,
  • False if a problem occurred. HError is used to identify the error.
<View Name>: Data source (or character string)
Name of the view to create. A Data Source variable is used to optimize the access time to the view items.
<File Name>: Character string (with or without quotes)
Name of data file used. This file can correspond to a data file described in the analysis or described by programming (HDescribeFile). You also have the ability to use a data source.
<List of Items>: Optional character string
List of items in the view. In this list, the different items are separated by commas or by CR characters (Carriage Return).
If this parameter is not specified or if it corresponds to "*", the items found in the data file will be included in the view.
<Sort Items>: Optional character string
List of sort items for the view. In this list, the sort items are separated by commas or by CR characters (Carriage Return). The sort is performed according to the order of the items in the list.
The sort direction can be specified for each item:
  • a "+" sign in front of the item name indicates an ascending sort order.
  • a "-" sign in front of the item name indicates a descending sort order.
If this parameter is not specified or if it corresponds to an empty string (""), no sort is performed in the view.
Hyper File 5.5 A single sort item must be specified in <Sort Items>.
<Selection Condition>: Optional character string
Selection condition of records. All items found in the data file can be included in the condition (key or non-key items).
No selection condition is applied if this parameter is not specified or if it corresponds to an empty string. This selection condition can be a character string in Ansi or Unicode format.
<Creation Mode>: Optional Integer constant (combination of constants)
Configures the creation mode of view.
hViewAddStores the content of the view during the next call to HExecuteView.
hViewLockingThe records read in the data file and included in the view are locked.
Windows Mobile This option is available for the HFSQL Client/Server data files and for the files handled by a native access. This option is not available for the HFSQL Mobile files. Indeed, no record can be locked. This limit is due to the operating system of Pocket PC.
hViewDefaultDefault creation mode of view
hViewPostponedThe view is created but it will be run later by HExecuteView. The data found in the view will be the data found during the execution of the view.
hViewDistinctThe view is created and the duplicates are deleted according to the sort key (in this case, the sort items must be specified)
If several items are specified, the duplicates are eliminated according to the composite key of the specified sort items.
Hyper File 5.5 If the hViewDistinct constant is specified, there is no need to specify a sort item in <Sort Items>. In this case, the hViewDistinct constant is ignored.
hViewExclusiveOptimizes the creation time of view by locking the entire source file.
hViewBreakableThe view creation can be interrupted by pressing the ESC key.
HFSQL Client/Server This constant is not available.
<Page Size>: Optional integer
Number of records per page (for a view used by remote access).
HFSQL Client/Server This parameter is ignored.
Remarks

Selection Condition

The general syntax of a condition has the following format:
"CustName>'Smith' and ZipCode=34 or ZipCode=32"
The supported operators depend on the type of items used in the condition:
<>DifferentValid for all types
>Greater thanValid for all types
>=Greater than or equal toValid for all types
<Less thanValid for all types
<=Less than or equal toValid for all types
=Strictly equal toValid for all types
~=Almost equal to: ignores the space characters on the right, the accented characters, the lowercase and uppercase charactersValid for string types only
~~Very flexible equality: does not distinguish between lowercase and uppercase characters, ignores the space characters found before and after the string to test, ignores the lowercase accented characters, ignores the space characters and the punctuation characters inside the strings.Valid for string types only
]Contains: takes the lowercase and uppercase characters into accountValid for string types only
~]Contains: ignores the lowercase and uppercase charactersValid for string types only
]=Starts with: takes the lowercase and uppercase characters into accountValid for string types only
Notes about the selection condition:
  • The constant strings must be enclosed in simple quotes.
  • <Item Name> must only contain letters, digits and underscore characters ("_"). If <Item Name> contains other characters (apostrophe, ...), the name of the item must be enclosed in double quotes.
    For example: "e_mail@"]'fr'
  • Comparisons between strings are performed according to the ASCII value of the characters and not according to the lexicographic value ('a' > 'Z').
  • The binary memos and the composite keys cannot be part of a selection condition.
  • If a <string constant> contains a simple quote (or a double quote), this simple quote (or double quote) must be preceded by a backslash character (\).
  • To optimize the browse, apply HStatCalculate to the data file before creating the view. Indeed, the HFSQL engine analyzes the selection condition and it uses these statistics to define the most discriminating items that will be used to optimize the browse operations performed on the data files.
  • This selection condition can be a character string in Ansi or Unicode format.
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppAjaxUser code (UMC)HFSQLHFSQL Client/ServerHyper File 5.5

Creating a view on a filtered data file

HCreateView takes into account the filter applied to the source data file of the view.
This characteristic is supported by the views created from HFSQL Classic or Client/Server, Hyper File 5.5 and xBase data files.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230hf.dll
Windows Mobile wp230hf.dll
Linux wd230hf.so
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment