|
|
|
|
|
- Selection condition
- Creating a view on a filtered data file
HCreateView (Function) In french: HCréeVue
Not available with this kind of connection
Warning
From version 20, SQL views and the materialized views are available. The views handled by this function correspond to the former view mechanism. They do not correspond to SQL views or to materialized views.
Creates an HFSQL view. Note: To merge multiple views, use function HMergeView. Reminder An HFSQL view is a "memory treemap" of all or part 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.
MyView is Data Source
HCreateView(MyView, CUSTOMER, "*", "NAME,CITY", "NAME]='A'", hViewDefault)
Syntax
Creating a view on a data file (data file described in the analysis or created through programming) Hide the details
<Result> = HCreateView(<View to create> , <Data file> [, <Items> [, <Sort items> [, <Selection condition>]]] [, <Creation mode> [, <Page size>]])
<Result>: Boolean - True if the view was created,
- False if a problem occurs. HError is used to identify the error.
<View to create>: Data source (or character string) View to create. A Data Source variable is used to optimize the access time to the view items. <Data file>: Character string Name of the data file used. This data file can correspond to a data file described in the analysis or through programming (HDescribeFile). You also have the ability to use a data source. <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 is an empty string (""), no sort is defined in the view. <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 an Ansi or Unicode character string. <Creation mode>: Optional Integer constant (combination of constants) Configures the creation mode of view. | | hViewAdd | Stores the content of the view next time HExecuteView is called. | hViewBreakable | Interrupt view creation by pressing the ESC key.
| hViewDefault | Default view creation mode | hViewDistinct | The 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 deleted according to the composition of the specified sort items.
| hViewExclusive | Lock the entire source file to reduce the view creation time. | hViewLocking | The records read in the data file and included in the view are locked.
| hViewPostponed | The 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. |
<Page size>: Optional integer Number of records per page (for a view used by remote access).
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: | | | <> | Different | Valid for all types | > | Greater than | Valid for all types | >= | Greater than or equal to | Valid for all types | < | Less than | Valid for all types | <= | Less than or equal to | Valid for all types | = | Strictly equal to | Valid for all types | ~= | Approximately equal: ignores right-hand spaces, accents and case. | Valid for string types only | ~~ | Very flexible equality: does not differentiate between uppercase and lowercase characters, ignores spaces before and after the string to be tested, ignores lowercase accented characters, ignores spaces and punctuation within strings. | Valid for string types only | ] | Contains: takes into account character case | Valid for string types only | ~] | Contains: does not take character case into account | Valid for string types only | ]= | Begins with: takes into account character case | Valid for string types only | Remarks on the selection condition:- Constant strings must be enclosed in single quotes.
- The item name must only contain letters, digits and underscore characters ("_"). If the item name contains other characters (quotes, etc.), it must be enclosed in double quotes.
For example: "e_mail@"]'en' - String comparisons are based on the ASCII value of the characters and not in a lexicographical way ('a' > 'Z').
- Binary memos and composite keys cannot be part of a selection condition.
- If a <string constant> contains a single quote (or a double quote), you must precede this single quote (or double quote) with a backslash ( \ ).
- To optimize the browse, use HStatCalculate on 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 an Ansi or Unicode character string.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|