Purpose Create a view on a Hyper File file.Syntax - Syntax 1: Creating a view on all the items found in a Hyper File file
<ViewIdentifier>= HCreateView_55(<File_Name>)- <ViewIdentifier> is a long integer used to identify the view.
- <FileName> is a character string that contains the name of the Hyper File file used by the view.
- Syntax 2: Creating a view on a selection of items found in a Hyper File file
<ViewIdentifier>= HCreateView_55(<File_Name>,<Items> [,<SortItem> [,<SelectionCondition> [,<CreationMode> ,<PageSize>]]]])- <ViewIdentifier> is a long integer used to identify the view.
- <FileName> is a character string that contains the name of the Hyper File file used by the view.
- <Items> is a string containing the list of items found in the view. The items are separated by a comma (", ").
- <SortItem> is a character string containing:
- the name of the initial sort item of the view. The sort order can be specified by prefixing the string by "+" or "-". By default, the sort is performed in ascending order ("+").
- an integer representing the subscript of the sort item among the "virtual" items of the view.
- <SelectionCondition> is a character string that contains the selection conditions of records. To specify no selection condition, all you have to do is use an empty string.
- <CreationMode> is an integer corresponding to a combination of the following WLanguage constants:
- hViewLocking locks the records that are read in the file
- hViewPostponed runs the view later with HExecuteView
- hViewExclusive optimizes the creation time of the view on a single computer
- hViewAdd stores the content of the view for the next hExecuteView
- hViewDistinct deletes the duplicates according to the sort key or to a record number
- <PageSize> is an integer indicating the number of records per page for a remote view (for a remote access).
- Syntax 3: Creating a view from two views with the same structure
<ViewIdentifier>=HCreateView_55(<IdentifierViewA>, <IdentifierViewB>,<OperationType> ,<Item>)- <ViewIdentifier> is a long integer used to identify the result view.
- <IdentifierViewA> is a long integer used to identify a view.
- <IdentifierViewB> is a long integer used to identify a view.
- <OperationType> is a WLanguage constant:
- hViewUnion union of all the rows found in view A and view B
- hViewUnionEx union of all the rows not common to view A and view B
- hViewIntersection rows common to A and B
- hViewSubtraction rows found in A - rows common with B
- hViewJoin Join between 2 views (only case where the views can have a different structure)
- <Item> is a string indicating the sort item, used to perform the operation between the views. It contains:
- the name of the sort item of the view.
- the subscript of the sort item among the "virtual" items of the view.
The sort order can be specified by prefixing the string by "+" or "-". By default, the sort is performed in ascending order ("+").
Details A Hyper File view can be compared with a "virtual" Hyper File file: the file is not physically stored on disk but it can be used as a "real" Hyper File file.Creating a view is a read operation performed on the files. It can go along with a lock operation of the records read, if modifications must be performed on the records. HCreateView_55 returns a long integer. It is the identifier of the view, equivalent to a file handle. hCreateView_55 returns 0 if an error occurs when the view is created. Details of <VirtualItems>: If no item from the main file is described, all the items of the main file are taken into account. The comma is used to separate between two descriptions of the item. <VirtualItems> must have the following format (this string is automatically built by the wizard for code input): "<AnItem> , <AnItem> , ..." Types of items not supported: - The "composite key" items cannot be used in a view.
- The "array" items cannot be used
- The items and the files with long names are supported.
Details of <SelectionConditions>: A selection condition is using the following syntax: "CustName>'Smith' and ZipCode=34 or ZipCode=32" The following operators are supported: | | | Operator | Meaning | Application | <> | 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 | ~= | Almost equal to | Valid for the string types (ignores the spaces on the right) | ] | Contains | Valid for string types only | ]= | Starts with | Valid for string types only | A selection condition is an <Expression> string where expression has the following format:<Factor> [<Or/And> <Expression>] with <Factor>: <SimpleItem> <Operator><SimpleItem> or <Not> <Factor> or (<Expression>) with <Operator>: One of the above-mentioned operators with <SimpleItem>: <ItemName> or <NumericConstant> or <'StringConstant'> Caution: - <ItemName> must only contain letters, digits and underscore characters ("_"), otherwise double quotes must be used: <Item Name with other characters">
- If the string to test in the selection condition contains a quote, the quote must be replaced by \'
- The "constant" strings must be enclosed in simple quotes.
- Cannot be included in a selection condition:
- The binary memos
- The subscripted items and the "Array" items
Details of <CreationMode>: The read mode is a combination of constants that allow you to describe how the view will be built. The authorized constants are as follows: - hViewLocking to lock the records read in the file
- hViewPostponed to run the view later with HExecuteView
- hViewExclusive to optimize the creation time of the view in single-user mode
- hViewAdd stores the content of the view during the next call to HExecuteView
- hViewDistinct to delete the duplicates according to the sort key or to a record number
Notes Caution: If HCreateView_55 is used during a file browse to create a view on this same file, the browse may be altered. In this case, we recommend that you use HSavePosition and HRestorePosition.- Code that must not be used:
HReadFirst(File, Key) // First record according to the key HCreateView_55(File, ...) HReadNext(File,Key) // Danger: // This is not necessarily the second record read according to the key
- Recommended code:
HReadFirst(File, Key) // First record according to the key Num = HSavePosition(File) HCreateView_55(File, ...) HRestorePosition(Num) HReadNext(File, Key)
The comparable types are: - all the numeric types among themselves (including the currencies)
- all the character strings among themselves (asciiz, basic, pascal, text memos)
All items of main file can be part of the condition, even the ones that do not belong to the virtual items. The condition is applied to each virtual record before it is included in the view. Therefore, you cannot specify several mutually excluding conditions for the same record (join). For example: - "Date='1997' and Date='1996'" returns no result
- "Date>='1996' and Date<='1997' returns all the records found between 1996 and 1997.
The comparisons between strings are performed according to the ASCII value of the characters (and not according to the lexicographic value). Caution: 'a' > 'Z' The numeric constants are real if they contain a decimal part (ex: 100.0) The size of a view cannot exceed: 16MB - 64 KB (16MB minus 64 KB). |