DBCREATEINDEX() Create an index file ------------------------------------------------------------------------------ Syntax DBCREATEINDEX(<cIndexName>, <cKeyExpr>, [<bKeyExpr>], [<lUnique>]) --> NIL Arguments <cIndexName> is a character value that specifies the file name of the index file to be created. <cKeyExpr> is a character value that expresses the index key expression in textual form. <bKeyExpr> is a code block that expresses the index key expression in executable form. <lUnique> is an optional logical value that specifies whether a unique index is to be created. If <lUnique> is omitted, the current global _SET_UNIQUE setting is used. Returns DBCREATEINDEX() always returns NIL. Description DBCREATEINDEX() creates an index for the database (.dbf) file associated with the current work area. If the work area has active indexes, they are closed. After the new index is created, it becomes the controlling index for the work area and is positioned to the first logical record. DBCREATEINDEX() performs the same function as the standard INDEX command. For more information, refer to the INDEX command. Notes . Side effects: DBCREATEINDEX() is guaranteed to create an index that, when made active, will impose the specified logical order on the database. The key expression is not necessarily evaluated at any particular time, by any particular means, or on any particular record or series of records. If the key expression relies on information external to the database file or work area, the effect is unpredictable. If the key expression changes the state of the work area (e.g., by moving to a different record or changing the contents of a record), the effect is unpredictable. . Evaluation context: When the key expression is evaluated, the associated work area is automatically selected as the current work area before the evaluation; the previously selected work area is automatically restored afterward. . Network environment: DBCREATEINDEX() creates the new index for the exclusive use of the current process. . Illegal expression: If <cKeyExpr> evaluates to an illegal expression, the code block will always evaluate to end-of-file (EOF). Examples . This example creates an index file, Name, indexed on the Name field: USE Employees NEW DBCREATEINDEX( "Name", "Name", { || Name }) Files Library is CLIPPER.LIB.
See Also: DBCLEARIND() DBREINDEX() DBSETINDEX() DBSETORDER()
Pingback: C5_UPDATE | Viva Clipper !
Pingback: C5_SET UNIQUE | Viva Clipper !