nFields AFIELDS([<aFieldNames>], [<aTypes>], [<aWidths>], [<aDecimals>]) cAlias ALIAS([<nWorkArea>]) lBoundary BOF() lSuccess BROWSE([<nTop>], [<nLeft>], [<nBottom>], [<nRight>]) NIL DBAPPEND([<lReleaseRecLocks>]) NIL DBCLEARFILTER() NIL DBCLEARINDEX() NIL DBCLEARRELATION() NIL DBCLOSEALL() NIL DBCLOSEAREA() NIL DBCOMMIT() NIL DBCOMMITALL() NIL DBCREATE(<cDatabase>, <aStruct>,[<cDriver>]) NIL DBCREATEINDEX(<cIndexName>, <cKeyExpr>, [<bKeyExpr>], [<lUnique>]) NIL DBDELETE() NIL DBEDIT([<nTop>], [<nLeft>], [<nBottom>], <nRight>], [<acColumns>], [<cUserFunction>], [<acColumnSayPictures> | <cColumnSayPicture>], [<acColumnHeaders> | <cColumnHeader>], [<acHeadingSeparators> | <cHeadingSeparator>], [<acColumnSeparators> | <cColumnSeparator>], [<acFootingSeparators> | <cFootingSeparator>], [<acColumnFootings> | <cColumnFooting>]) NIL DBEVAL(<bBlock>,[<bForCondition>],[<bWhileCondition>],[<nNextRecords>], [<nRecord>],[<lRest>]) cAlias DBF() cFilter DBFILTER() NIL DBGOBOTTOM() NIL DBGOTO(<xIdentity>) NIL DBGOTOP() NIL DBRECALL() NIL DBREINDEX() cLinkExp DBRELATION(<nRelation>) nWorkArea DBRSELECT(<nRelation>) lFound DBSEEK(<expKey>, [<lSoftSeek>], [<lLast>]) NIL DBSELECTAREA(<nArea> | <cAlias>) cCurrentDriver DBSETDRIVER([<cDriver>]) NIL DBSETFILTER(<bCondition>, [<cCondition>]) NIL DBSETINDEX(<cOrderBagName>) NIL DBSETORDER(<nOrderNum>) NIL DBSETRELATION(<nArea> | <cAlias>, <bExpr>, <cExpr>) NIL DBSKIP([<nRecords>]) aStruct DBSTRUCT() NIL DBUNLOCK() NIL DBUNLOCKALL() NIL DBUSEAREA( [<lNewArea>], [<cDriver>], <cName>, [<xcAlias>], [<lShared>], [<lReadonly>]) <cPath> DefPath() lDeleted DELETED() ValueInverted DESCEND(<exp>) nOsCode DOSERROR([<nNewOsCode>]) lBoundary EOF() nFields FCOUNT() nErrorCode FERROR() bFieldBlock FIELDBLOCK(<cFieldName>) ValueField FIELDGET(<nField>) cFieldName FIELDNAME/FIELD(<nPosition>) nFieldPos FIELDPOS(<cFieldName>) ValueAssigned FIELDPUT(<nField>, <expAssign>) bFieldWBlock FIELDWBLOCK(<cFieldName>, <nWorkArea>) lExists FILE(<cFilespec>) <aSelected> __Fledit( <aSrc>, <aList>) lSuccess FLOCK() lSuccess FOUND() nBytes HEADER() cExtension INDEXEXT() cKeyExp INDEXKEY(<nOrder>) nOrder INDEXORD() nRecords LASTREC() | RECCOUNT()* dModification LUPDATE() cTextBuffer MEMOEDIT([<cString>], [<nTop>], [<nLeft>], [<nBottom>], [<nRight>], [<lEditMode>], [<cUserFunction>], [<nLineLength>], [<nTabSize>], [<nTextBufferRow>], [<nTextBufferColumn>], [<nWindowRow>], [<nWindowColumn>]) cString MEMOREAD(<cFile>) lSuccess MEMOWRIT(<cFile>, <cString>) lError NETERR([<lNewError>]) cBagExt ORDBAGEXT() cOrderBagName ORDBAGNAME(<nOrder> | <cOrderName>) NIL ORDLISTADD(<cOrderBagName> [, <cOrderName>]) nRecords RECCOUNT() | LASTREC() Identity RECNO() nBytes RECSIZE() lSuccess RLOCK() nWorkArea SELECT([<cAlias>]) lDbfOpen USED() <nCode> WEIGHTASC(<sString>) <sTable> WEIGHTTABLE()
AFIELDS([<aFieldNames>], [<aTypes>], [<aWidths>], [<aDecimals>]) --> nFields
AFIELDS() is an array function that fills a series of arrays (structure attribute arrays) with the structure of the database file currently open, one element in each array per field. AFIELDS() works like ADIR(), filling a series of existing arrays with information. To use AFIELDS(), you must first create the arrays to hold the database structure information, each with the same number of elements as the number of fields (i.e. FCOUNT()). Once the structure attribute arrays are created, you can then invoke AFIELDS() to fill the structure arrays with information about each field.
By default, AFIELDS() operates on the currently selected work area. It can operate on an unselected work area if you specify it within an aliased expression (see example below).
AFIELDS() is a compatibility function and therefore is not recommended. It is superseded by DBSTRUCT(), which does not require the existence of any arrays prior to invocation and returns a multidimensional array containing the current database file structure.
<aFieldNames> | is the array to fill with field names. Each element is a character string. |
<aTypes> | is the array to fill with the type of fields in |
<aFieldNames> | . Each element is a character string. |
<aWidths> | is the array to fill with the widths of fields in |
<aFieldNames> | . Each element is numeric data type. |
<aDecimals> | is the array to fill with the number of decimals defined for fields in <aFieldNames>. Each element is numeric data type. If the field type is not numeric, the <aDecimals> element is zero. |
Returns : | AFIELDS() returns the number of fields or the length of the shortest array argument, whichever is less. If no arguments are specified, or if there is no file in USE in the current work area, AFIELDS() returns zero. |
See also : | ACHOICE() ADIR()* AEVAL() ASCAN() DBCREATE() |
ALIAS([<nWorkArea>]) --> cAlias
ALIAS() is a database function that determines the alias of a specified work area. An alias is the name assigned to a work area when a database file is USEd. The actual name assigned is either the name of the database file, or a name explicitly assigned with the ALIAS clause of the USE command.
ALIAS() is the inverse of the SELECT() function. ALIAS() returns the alias name given the work area number, and SELECT() returns the work area number given the alias name.
This example returns the name of the previously selected work area:
USE File1 NEW ALIAS Test1 nOldArea := SELECT() USE File2 NEW ALIAS Test2 ? ALIAS( nOldArea ) // Returns Test1
<nWorkArea> | is any work area number. |
Returns : | ALIAS() returns the alias of the specified work area as a character string in uppercase. If <nWorkArea> is not specified, the alias of the current work area is returned. If there is no database file in USE for the specified work area, ALIAS() returns a null string (""). |
See also : | SELECT() |
BOF() --> lBoundary
BOF() is a database function used to test for a boundary condition when you are moving the record pointer backward through a database file using the SKIP command. A simple usage example is a descending order record list with an ascending order index file. A more sophisticated example is a screen paging routine that pages forward or backward through the current database file based on the key the user presses. When the user attempts to page backward, you would use BOF() to test for a beginning of file condition before using the SKIP command to move the record pointer and repaint the screen.
Once BOF() is set to true (.T.), it retains its value until there is another attempt to move the record pointer.
By default, BOF() operates on the currently selected work area. It can be made to operate on an unselected work area by specifying it within an aliased expression (see example below).
The SKIP command is the only record movement command that can set BOF() to true (.T.).
Returns : | BOF() returns true (.T.) after an attempt to SKIP backward beyond the first logical record in a database file; otherwise, it returns false (.F.). If there is no database file open in the current work area, BOF() returns false (.F.). If the current database file contains no records, BOF() returns true (.T.). |
See also : | EOF() |
BROWSE([<nTop>], [<nLeft>], [<nBottom>], [<nRight>]) --> lSuccess
BROWSE() is a user interface function that invokes a general purpose table-oriented browser and editor for records in the current work area. For a list of the navigation keys which are used by BROWSE(), refer to the DBEDIT() function. Note that Browse() is a compatibility function. DBEDIT() should be used in its place. For a more complicated BROWSE(), TBROWSE() should be used.
<nTop> | , <nLeft>, <nBottom>, and <nRight> define the window coordinates. If not specified, the default window coordinates are 1, 0 to MAXROW(), and MAXCOL(). |
Returns : | BROWSE() always return NIL. |
See also : | DBEDIT() |
DBAPPEND([<lReleaseRecLocks>]) --> NIL
DBAPPEND() is a database function that lets you add records to the current database. The enhancement to this function lets you maintain multiple record locks during an append.
DBAPPEND() without a parameter as in earlier versions of xClipper, clears all pending record locks prior to an append. This is the same as DBAPPEND(.T.).
<lReleaseRecLocks> | is a logical data type that if true (.T.), clears all pending record locks, then appends the next record. If |
<lReleaseRecLocks> | is false (.F.), all pending record locks are maintained and the new record is added to the end of the Lock List. The default value of <lReleaseRecLocks> is true (.T.). |
Returns : | DBAPPEND() always returns NIL. |
See also : | DBDELETE() DBRECALL() |
DBCLEARFILTER() --> NIL
DBCLEARFILTER() clears the logical filter condition, if any, for the current work area.
DBCLEARFILTER() performs the same function as the standard SET FILTER command with no expression specified. For more information, refer to the SET FILTER command.
Returns : | DBCLEARFILTER() always returns NIL. |
See also : | DBFILTER() DBSETFILTER() |
DBCLEARINDEX() --> NIL
DBCLEARINDEX() closes any active indexes for the current work area. Any pending index updates are written and the index files are closed.
DBCLEARINDEX() performs the same function as the standard SET INDEX command with no indexes specified. For more information, refer to the SET INDEX command.
Returns : | DBCLEARINDEX() always returns NIL. |
See also : | DBCREATEINDEX() DBREINDEX() DBSETINDEX() DBSETORDER() |
DBCLEARRELATION() --> NIL
DBCLEARRELATION() clears any active relations for the current work area.
DBCLEARRELATION() performs the same function as the standard SET RELATION TO command with no clauses specified. For more information, refer to the SET RELATION command.
Returns : | DBCLEARRELATION() always returns NIL. |
See also : | DBSETRELATION() |
DBCLOSEALL() --> NIL
DBCLOSEALL() releases all occupied work areas from use. It is equivalent to calling DBCLOSEAREA() on every occupied work area. DBCLOSEALL() has the same effect as the standard CLOSE DATABASES command. For more information, refer to the USE and CLOSE commands.
Returns : | DBCLOSEALL() always returns NIL. |
See also : | DBCLOSEAREA() DBUSEAREA() |
DBCLOSEAREA() --> NIL
DBCLOSEAREA() releases the current work area from use. Pending updates are written, pending locks are released, and any resources associated with the work area are closed or released. DBCLOSEAREA() is equivalent to the standard CLOSE command or the USE command with no clauses. For more information, refer to the USE and CLOSE commands.
Returns : | DBCLOSEAREA() always returns NIL. |
See also : | DBCLOSEALL() DBCOMMIT() DBUSEAREA() |
DBCOMMIT() --> NIL
DBCOMMIT() causes all updates to the current work area to be written to disk. All updated database and index buffers are written to DOS and a DOS COMMIT request is issued for the database (.dbf) file and any index files associated with the work area.
DBCOMMIT() performs the same function as the standard COMMIT command except that it operates only on the current work area. For more information, refer to the COMMIT command.
Returns : | DBCOMMIT() always returns NIL. |
See also : | DBCLOSEALL() DBCOMMITALL() DBUNLOCK() |
DBCOMMITALL() --> NIL
DBCOMMITALL() causes all pending updates to all work areas to be written to disk. It is equivalent to calling DBCOMMIT() for every occupied work area.
For more information, refer to DBCOMMIT() and the COMMIT command.
Returns : | DBCOMMITALL() always returns NIL. |
See also : | DBCLOSEALL() DBCOMMIT() DBUNLOCK() |
DBCREATE(<cDatabase>, <aStruct>,[<cDriver>]) --> NIL
DBCREATE() is a database function that creates a database file from an array containing the structure of the file. You may create the array programmatically or by using DBSTRUCT(). DBCREATE() is similar to the CREATE FROM command which creates a new database file structure from a structure extended file. Use CREATE or COPY STRUCTURE EXTENDED commands to create a structure extended file.
Before using DBCREATE(), you must first create the <aStruct> array and fill it with the field definition arrays according to the structure in Field Definition Subarray table (above). There are some specific rules for creating a field definition array, including:
Specify all field attributes with a value of the proper data type for the attribute. The decimals attribute must be specified-- even for non-numeric fields. If the field does not have a decimals attribute, specify zero.
Specify the type attribute using the first letter of the data type as a minimum. Use longer and more descriptive terms for readability. For example, both "C" and "Character" can be specified as the type attribute for character fields.
In xClipper, character fields contain up to 64,000 characters. Unlike the CREATE FROM command, DBCREATE() does not use the decimals attribute to specify the high-order part of the field length. Specify the field length directly, regardless of its magnitude.
To make references to the various elements of the field definition subarray more readable, the header file called dbstruct.ch is supplied. It contains the #defines to assign a name to the array position for each field attribute. It is located in \include.
<cDatabase> | is the name of the new database file, with an optional drive and directory, specified as a character string. If specified without an extension, .dbf is assumed. |
<aStruct> | is an array that contains the structure of <cDatabase> as a series of subarrays, one per field. Each subarray contains the definition of each field's attributes and has the following structure: Field Definition Subarray ------------------------------------------------------------------------ Position Metasymbol dbstruct.ch ------------------------------------------------------------------------ 1 cName DBS_NAME 2 cType DBS_TYPE 3 nLength DBS_LEN 4 nDecimals DBS_DEC ------------------------------------------------------------------------ |
<cDriver> | specifies the replaceable database driver (RDD) to use to process the current work area. <cDriver> is the name of the RDD specified as a character expression. If you specify <cDriver> as a literal value, you must enclose it in quotes. |
Returns : | DBCREATE() always returns NIL. |
See also : | AFIELDS() DBSTRUCT() |
DBCREATEINDEX(<cIndexName>, <cKeyExpr>, [<bKeyExpr>], [<lUnique>]) --> NIL
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.
<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. |
See also : | DBCLEARINDEX() DBREINDEX() DBSETINDEX() DBSETORDER() AFIELDS() DBSTRUCT() |
DBDELETE() --> NIL
DBDELETE() marks the current record as deleted. Records marked for deletion can be filtered using SET DELETED or removed from the file using the PACK command.
DBDELETE() performs the same function as the standard DELETE command with a scope of the current record. For more information, refer to the DELETE command.
Returns : | DBDELETE() always returns NIL. |
See also : | DBRECALL() |
DBEDIT([<nTop>], [<nLeft>], [<nBottom>], <nRight>], [<acColumns>], [<cUserFunction>], [<acColumnSayPictures> | <cColumnSayPicture>], [<acColumnHeaders> | <cColumnHeader>], [<acHeadingSeparators> | <cHeadingSeparator>], [<acColumnSeparators> | <cColumnSeparator>], [<acFootingSeparators> | <cFootingSeparator>], [<acColumnFootings> | <cColumnFooting>]) --> NIL
DBEDIT() is a user interface and compatibility function that displays records from one or more work areas in a table form. The DBEDIT() window display is a grid of cells divided into columns and rows. Columns correspond to database fields and rows correspond to database records. Each column is defined by an element of the <acColumns> array. The display width of each column is determined by the evaluation of the column expression in <acColumns> array or the column picture specified in the <acColumnSayPictures> array.
All cursor movement keys are handled within DBEDIT(), including Page up, Page down, Home, End, the four arrow keys, and all Ctrl key combinations that produce cursor movement. The navigation keys that DBEDIT() responds to when a user function argument is not specified are listed in the Active Keys table below:
DBEDIT() Active Keys ------------------------------------------------------------------------ Key Action ------------------------------------------------------------------------ Up arrow Up one row Down arrow Down one row Left arrow Column left Right arrow Column right Ctrl+Left arrow Pan left one column Ctrl+Right arrow Pan right one column Home Leftmost current screen column End Rightmost current screen column Ctrl+Home Leftmost column Ctrl+End Rightmost column PgUp Previous screen PgDn Next screen Ctrl+PgUp First row of current column Ctrl+PgDn Last row of current column Return Terminate DBEDIT() Esc Terminate DBEDIT() ------------------------------------------------------------------------
When the user function argument (<cUserFunction>) is specified, all keys indicated in the Active Keys table are active with the exception of Esc and Return. When DBEDIT() calls the user function, it automatically passes two arguments:
The current mode passed as a numeric value
The index of the current column in <acColumns> passed as a numeric value
The mode parameter indicates the current state of DBEDIT() depending on the last key executed. The possible mode values are listed in the DBEDIT() Modes table below:
DBEDIT() Modes ------------------------------------------------------------------------ Status Dbedit.ch Description ------------------------------------------------------------------------ 0 DE_IDLE Idle, any cursor movement keystrokes have been handled and no keystrokes are pending 1 DE_HITTOP Attempt to cursor past top of file 2 DE_HITBOTTOM Attempt to cursor past bottom of file 3 DE_EMPTY No records in work area 4 DE_EXCEPT Key exception ------------------------------------------------------------------------
The index parameter points to the position of the current column definition in the <acColumns> array. If <acColumns> is not specified, the index parameter points to the position of the field in the current database structure. Access the field name using FIELD().
A user-defined function must return a value that indicates to DBEDIT() the action to perform. The User Function Return Values table below lists the possible return values and the corresponding actions:
DBEDIT() User Function Return Values ------------------------------------------------------------------------ Value Dbedit.ch Description ------------------------------------------------------------------------ 0 DE_ABORT Abort DBEDIT() 1 DE_CONT Continue DBEDIT() 2 DE_REFRESH Force reread/repaint and continue; after repaint, process keys and go to idle ------------------------------------------------------------------------
A number of instances affect calls to the user function:
A key exception occurs. This happens when DBEDIT() fetches a keystroke that it does not recognize from the keyboard. Any pending keys remain in the keyboard buffer until fetched within the user function or until DBEDIT() continues.
DBEDIT() enters the idle mode (i.e., all pending keys have been processed). This happens when the keyboard is empty or after a screen refresh. In this instance, there is one call to the user function and then DBEDIT() waits for a key.
Beginning or end of file is encountered. This is the same as idle. All executable keys are performed, and there is one call to the user function with the appropriate status message.
Note that when DBEDIT() is first executed, all keys pending in the keyboard buffer are executed and then DBEDIT() enters the idle mode with a user function call. If no keys are pending, the idle mode is immediate.
The user function should handle all modes and status messages received from DBEDIT().
A user-defined function must ensure that the DBEDIT() status is equivalent to DE_EXCEPT (4); otherwise, the value of LASTKEY() is meaningless and a Return value of DE_REFRESH (2) will place the application into an endless loop. For example:
FUNCTION DBEditFunc ( nMode, nColumnPos ) LOCAL RetVal := DE_CONT
IF ( nMode == DE_EXCEPT ) IF ( LASTKEY() == K_F5 ) RetVal := DE_REFRESH ENDIF ENDIF RETURN( RetVal )
DBEDIT() is fully re-entrant, which means you can make nested calls to it. Using this feature, you can have multiple browse windows on the screen at the same time.
DBEDIT() is a compatibility function and, therefore, no longer recommended as a programmable browse facility. As such, it is superseded by the TBrowse object class. For more information, refer to TBrowse class in this chapter.
<nTop> | , <nLeft>, <nBottom>, and <nRight> define the upper-left and lower-right coordinates of the DBEDIT() window. Row values can range from zero to MAXROW() and column positions can range from zero to MAXCOL(). If not specified, the default coordinates are 0, 0, MAXROW(), and MAXCOL(). |
<acColumns> | is an array of character expressions containing database field names or expressions to use as column values for each row displayed. If this argument is not specified, DBEDIT() displays all fields in the current work area as columns. |
<cUserFunction> | is the name of a user-defined function that executes when an unrecognizable key is pressed or there are no keys pending in the keyboard buffer. Specify the function name as a character expression without parentheses or arguments. Note that the behavior of DBEDIT() is affected by the presence of this argument. Refer to the discussion below for more information. |
<acColumnSayPictures> | is a parallel array of picture clauses to format each column. Specifying <cColumnSayPicture> instead of an array displays all columns with the same format. Refer to TRANSFORM() or @...SAY for more information on pictures. |
<acColumnHeaders> | is a parallel array of character expressions that define the headings for each column. Specifying <cColumnHeader> gives the same heading for all columns. To display a multi-line heading, embed a semicolon in the heading expression where you want the string to break. If not specified, column headings are taken from the <acColumns> array or the field names in the current work area, if the <acColumns> argument is not specified. |
<acHeadingSeparators> | is a parallel array of character expressions that define the characters used to draw horizontal lines separating column headings from the field display area. Specifying |
<cHeadingSeparator> | instead of an array uses the same heading separator for all columns. If this argument is not specified, the default separator is a double graphics line. |
<acColumnSeparators> | is a parallel array of character expressions that define the characters used to draw vertical lines separating the columns. Specifying <cColumnSeparator> instead of an array uses the same separator for all columns. If this argument is not specified, the default separator is a single graphics line. |
<acFootingSeparators> | is a parallel array of character expressions that define the characters used to draw horizontal lines separating column footings from the field display area. Specifying |
<cFootingSeparator> | instead of an array uses the same footing separator for all columns. If this argument is not specified, there is no footing separator. |
<acColumnFootings> | is a parallel array of character expressions that define footings for each column. Specifying <cColumnFooting> instead of an array gives the same footing for all columns. To display a multi- line footing, embed a semicolon in the footing expression where you want the string to break. If this argument is not specified, there are no column footings. |
Returns : | DBEDIT() always returns NIL. |
See also : | ACHOICE() BROWSE() MEMOEDIT() TRANSFORM() |
DBEVAL(<bBlock>,[<bForCondition>],[<bWhileCondition>],[<nNextRecords>], [<nRecord>],[<lRest>]) --> NIL
DBEVAL() is a database function that evaluates a single block for each record within the current work area that matches a specified scope and/or condition. On each iteration, DBEVAL() evaluates the specified block. All records within the scope or matching the condition are processed until the end of file is reached.
By default, DBEVAL() operates on the currently selected work area. It will operate on an unselected work area if you specify it as part of an aliased expression.
DBEVAL() is similar to AEVAL() which applies a block to each element in an array. Like AEVAL(), DBEVAL() can be used as a primitive for the construction of user-defined commands that process database files. In fact, many of the standard xClipper database processing commands are created using DBEVAL().
Refer to the Code Blocks section in the "Basic Concepts" chapter of the Programming and Utilities Guide for more information on the syntax and theory of code blocks; and refer also to the Database System section in the same chapter for information on record scoping and conditions. Also refer to the xClipper standard header file, std.ch, found in \include for examples of xClipper database command definitions that use DBEVAL().
<bBlock> | is a code block to execute for each record processed. |
<bForCondition> | is an optional condition specified as a code block that is evaluated for each record in the scope. It provides the same functionality as the FOR clause of record processing commands. |
<bWhileCondition> | is an optional condition specified as a code block that is evaluated for each record from the current record until the condition returns false (.F.). It provides the same functionality as the WHILE clause of record processing commands. |
<nNextRecords> | is an optional number that specifies the number of records to process starting with the current record. It is the same as the NEXT clause. |
<nRecord> | is an optional record number to process. If this argument is specified, <bBlock> will be evaluated for the specified record. This argument is the same as the RECORD clause. |
<lRest> | is an optional logical value that determines whether the scope of DBEVAL() is all records, or, starting with the current record, all records to the end of file. This argument corresponds to the REST and ALL clauses of record processing commands. If true (.T.) , the scope is REST; otherwise, the scope is ALL records. If <lRest> is not specified the scope defaults to ALL. |
Returns : | DBEVAL() always returns NIL. |
See also : | AEVAL() EVAL() |
DBF() --> cAlias
DBF() is a compatibility function that replicates the DBF() function in xBASE. xClipper implements it by invoking the ALIAS() function without an argument.
DBF() is a compatibility function and, therefore, no longer recommended. It is superseded entirely by the ALIAS() function.
DBFILTER() --> cFilter
DBFILTER() is a database function used to save and re-execute an active filter by returning the filter expression as a character string that can be later recompiled and executed using the macro operator (&). This function operates like the DBRELATION() and DBRSELECT() functions which save and re-execute the linking expression of a relation within a work area.
Since each work area can have an active filter, DBFILTER() can return the filter expression of any work area. This is done by referring to DBFILTER() within an aliased expression as demonstrated below.
Returns : | DBFILTER() returns the filter condition defined in the current work area as a character string. If no FILTER has been SET, DBFILTER() returns a null string (""). |
See also : | DBRELATION() DBRSELECT() |
DBGOBOTTOM() --> NIL
DBGOBOTTOM() moves to the last logical record in the current work area.
DBGOBOTTOM() performs the same function as the standard GO BOTTOM command. For more information, refer to the GO command.
DBGOTO(<xIdentity>) --> NIL
DBGOTO() is a database function that positions the record pointer in the current work area at the specified <xIdentity>. In an Xbase data structure, this identity is the record number because every record, even an empty record, has a record number. In non-Xbase data structures, identity may be defined as something other than record number.
<xIdentity> | is a unique value guaranteed by the structure of the data file to reference a specific item in a data source (database). In a Xbase data structure (.dbf) <xIdentity> is the record number. In other data formats, <xIdentity> is the unique primary key value. |
<xIdentity> | could be an array offset or virtual memory handle if the data set is in memory instead of on disk. |
Returns : | DBGOTO() always returns NIL. |
See also : | BOF() DBGOBOTTOM() DBGOTOP() DBSEEK() DBSKIP() EOF() |
DBGOTOP() --> NIL
DBGOTOP() moves to the first logical record in the current work area.
DBGOTOP() performs the same function as the standard GO TOP command. For more information, refer to the GO TOP command.
Returns : | DBGOTOP() always returns NIL. |
See also : | BOF() DBGOBOTTOM() DBSEEK() DBSKIP() EOF() |
DBRECALL() --> NIL
DBRECALL() causes the current record to be reinstated if it is marked for deletion.
DBRECALL() performs the same function as the RECALL command. For more information, refer to the DELETE and RECALL commands.
Returns : | DBRECALL() always returns NIL. |
See also : | DBDELETE() |
DBREINDEX() --> NIL
DBREINDEX() rebuilds all active indexes associated with the current work area. After the indexes are recreated, the work area is moved to the first logical record in the controlling order.
DBREINDEX() performs the same function as the standard REINDEX command. For more information, refer to the REINDEX command.
Returns : | DBREINDEX() always returns NIL. |
See also : | DBCLEARINDEX() DBCREATEINDEX() DBSETINDEX() DBSETORDER() |
DBRELATION(<nRelation>) --> cLinkExp
DBRELATION() is a database function used with DBRSELECT() to determine the linking expression and work area of an existing relation created with the SET RELATION command.
DBRELATION() returns the linking expression defined by the TO clause. DBRSELECT() returns the work area linked as defined by the INTO clause.
By default, DBRELATION() operates on the currently selected work area. It will operate on an unselected work area if you specify it as part of an aliased expression (see example below).
<nRelation> | is the position of the desired relation in the list of current work area relations. The relations are numbered according to the order in which they were defined with SET RELATION. |
Returns : | DBRELATION() returns a character string containing the linking expression of the relation specified by <nRelation>. If there is no RELATION SET for <nRelation>, DBRELATION() returns a null string (""). |
See also : | DBFILTER() DBRSELECT() |
DBRSELECT(<nRelation>) --> nWorkArea
DBRSELECT() is a database function used in combination with DBRELATION() to determine the work area and linking expression of an existing relation created with the SET RELATION command. DBRSELECT() returns the work area defined by the INTO clause. DBRELATION() returns the linking expression defined by the TO clause. To determine the alias of the relation instead of the work area number, use the expression ALIAS(DBRSELECT(<nRelation>)).
By default, DBRSELECT() operates on the currently selected work area. It will operate on an unselected work area if you specify it as part of an aliased expression (see example below).
<nRelation> | is the position of the desired relation in the list of current work area relations. The relations are numbered according to the order in which they were defined with SET RELATION. |
Returns : | DBRSELECT() returns the work area number of the relation specified by <nRelation> as an integer numeric value. If there is no RELATION SET for <nRelation>, DBRSELECT() returns zero. |
See also : | DBFILTER() DBRELATION() RLOCK() |
DBSEEK(<expKey>, [<lSoftSeek>], [<lLast>]) --> lFound
DBSEEK() moves to the first logical record whose key value is equal to <expKey>. If such a record is found, it becomes the current record and DBSEEK() returns true (.T.); otherwise, it returns false (.F.). the positioning of the work area is as follows: for a normal (not soft) seek, the work area is positioned to LASTREC() + 1 and EOF() returns true (.T.); for a soft seek, the work area is positioned to the first record whose key value is greater than the specified key value. If no such record exists, the work area is positioned to LASTREC() + 1 and EOF() returns true (.T.).
For a work area with no active indexes, DBSEEK() has no effect.
DBSEEK() performs the same function as the standard SEEK command. For more information, refer to the SEEK command.
<expKey> | is a value of any type that specifies the key value associated with the desired record. |
<lSoftSeek> | is an optional logical value that specifies whether a soft seek is to be performed. This determines how the work area is positioned if the specified key value is not found (see below). If |
<lSoftSeek> | is omitted, the current global _SET_SOFTSEEK setting is used. |
<lLast> | is specified as true (.T.) to seek the last occurrence of the specified key value. False (.F.), the default, seeks the first occurrence. Note: This parameter is only supported for specific RDDs. DBFNTX is NOT one of them. |
Returns : | DBSEEK() returns true (.T.) if the specified key value was found; otherwise, it returns false (.F.). |
See also : | DBGOBOTTOM() DBGOTOP() DBSKIP() EOF() FOUND() |
DBSELECTAREA(<nArea> | <cAlias>) --> NIL
DBSELECTAREA() causes the specified work area to become the current work area. All subsequent database operations will apply to this work area unless another work area is explicitly specified for an operation. DBSELECTAREA() performs the same function as the standard SELECT command. For more information, refer to the SELECT command.
<nArea> | is a numeric value between zero and 250, inclusive, that specifies the work area being selected. |
<cAlias> | is a character value that specifies the alias of a currently occupied work area being selected. |
Returns : | DBSELECTAREA() always returns NIL. |
See also : | DBUSEAREA() RLOCK() SELECT() |
DBSETDRIVER([<cDriver>]) --> cCurrentDriver
DBSETDRIVER() sets the database driver to be used when activating new work areas without specifying a driver. If the specified driver is not available to the application, the call has no effect. DBSETDRIVER() returns the name of the current default driver, if any.
<cDriver> | is an optional character value that specifies the name of the database driver that should be used to activate and manage new work areas when no driver is explicitly specified. |
Returns : | DBSETDRIVER() returns the name of the current default driver. |
See also : | DBUSEAREA() RLOCK() |
DBSETFILTER(<bCondition>, [<cCondition>]) --> NIL
DBSETFILTER() sets a logical filter condition for the current work area. When a filter is set, records which do not meet the filter condition are not logically visible. That is, database operations which act on logical records will not consider these records.
The filter expression supplied to DBSETFILTER() evaluates to true (.T.) if the current record meets the filter condition; otherwise, it should evaluate to false (.F.).
The filter expression may be a code block (<bCondition>) or both a code block and equivalent text (<cCondition>). If both versions are supplied, they must express the same condition. If the text version is omitted, DBFILTER() will return an empty string for the work area.
DBSETFILTER() performs the same function as the standard SET FILTER command. For more information, refer to the SET FILTER command.
<bCondition> | is a code block that expresses the filter condition in executable form. |
<cCondition> | stores the filter condition as a character string for later retrieval by the DBFILTER() function. If you omit this optional parameter, the DBFILTER() function will return an empty string for the work area. |
Returns : | DBSETFILTER() always returns NIL. |
See also : | DBCLEARFILTER() DBFILTER() |
DBSETINDEX(<cOrderBagName>) --> NIL
DBSETINDEX() is a database function that adds the contents of an order bag into the order list of the current work area. Any orders already associated with the work area continue to be active. If the newly opened order bag is the only order associated with the work area, it becomes the controlling order; otherwise, the controlling order remains unchanged. If the order bag contains more than one order, and there are no other orders associated with the work area, the first order in the new order bag becomes the controlling order.
Note: DBSETINDEX() does not close all currently open index files.
DBSETINDEX() is a compatibility command and therefore is not recommended. It is superseded by the ORDLISTADD() function.
<cOrderBagName> | is the name of a disk file containing one or more orders. You may specify <cOrderBagName> as the file name with or without the path name or extension. If you do not include the extension as part of <cOrderBagName>, xClipper uses the default extension of the current RDD. |
Returns : | DBSETINDEX() always returns NIL. |
See also : | ORDLISTADD() DBCLEARINDEX() DBCREATEINDEX() DBREINDEX() DBSETORDER() |
DBSETORDER(<nOrderNum>) --> NIL
DBSETORDER() controls which of the current work area's active indexes is the controlling index. The controlling index is the index which determines the logical order of records in the work area.
Active indexes are numbered from 1 to the number of active indexes, based on the order in which the indexes were opened. <nOrderNum> specifies the number of the desired index.
DBSETORDER() performs the same function as the standard SET ORDER command. For more information, refer to the SET ORDER command.
<nOrderNum> | is a numeric value that specifies which of the active indexes is to be the controlling index. |
Returns : | DBSETORDER() always returns NIL. |
See also : | DBCLEARINDEX() DBCREATEINDEX() DBREINDEX() DBSETINDEX() |
DBSETRELATION(<nArea> | <cAlias>, <bExpr>, <cExpr>) --> NIL
DBSETRELATION() relates the work area specified by <nArea> or <cAlias> (the child work area) to the current work area (the parent work area). Any existing relations remain active.
Relating work areas synchronizes the child work area with the parent work area. This is achieved by automatically repositioning the child work area whenever the parent work area moves to a new record. If there is an active index in the child work area, moving the parent work area causes an automatic SEEK operation in the child work area; the seek key is based on the expression specified by <bExpr> and/or <cExpr>. If the child work area has no active index, moving the parent work area causes an automatic GOTO in the child work area; the record number for the GOTO is based on the expression specified by <bExpr> and/or <cExpr>.
The relational expression may be a code block (<bExpr>) or both a code block and equivalent text (<cExpr>). If both versions are supplied, they must be equivalent. If the text version is omitted, DBRELATION() will return an empty string for the relation.
DBSETRELATION() performs the same function as the standard SET RELATION command with the ADDITIVE clause. For more information, refer to the SET RELATION command.
<nArea> | is a numeric value that specifies the work area number of the child work area. |
<cAlias> | is a character value that specifies the alias of the child work area. |
<bExpr> | is a code block that expresses the relational expression in executable form. |
<cExpr> | is a character value that expresses the relational expression in textual form. |
Returns : | DBSETRELATION() always returns NIL. |
See also : | DBCLEARRELATION() DBRELATION() DBRSELECT() FOUND() |
DBSKIP([<nRecords>]) --> NIL
DBSKIP() moves either forward or backward relative to the current record. Attempting to skip forward beyond the last record positions the work area to LASTREC() + 1 and EOF() returns true (.T.). Attempting to skip backward beyond the first record positions the work area to the first record and BOF() returns true (.T.).
DBSKIP() performs the same function as the standard SKIP command. For more information, refer to the SKIP command.
<nRecords> | is the number of logical records to move, relative to the current record. A positive value means to skip forward, and a negative value means to skip backward. If <nRecords> is omitted, a value of 1 is assumed. |
Returns : | DBSKIP() always returns NIL. |
See also : | BOF() DBGOBOTTOM() DBGOTOP() DBSEEK() EOF() |
DBSTRUCT() --> aStruct
DBSTRUCT() is a database function that operates like COPY STRUCTURE EXTENDED by creating an array of structure information rather than a database file of structure information. There is another function, DBCREATE(), that can create a database file from the structure array.
By default, DBSTRUCT() operates on the currently selected work area. It will operate on an unselected work area if you specify it as part of an aliased expression as shown below.
Note, a header file, dbstruct.ch, located in \include contains a series of manifest constants for each field attribute.
Returns : | DBSTRUCT() returns the structure of the current database file in an array whose length is equal to the number of fields in the database file. Each element of the array is a subarray containing information for one field. The subarrays have the following format: DBSTRUCT() Return Array ------------------------------------------------------------------------ Position Metasymbol dbstruct.ch ------------------------------------------------------------------------ 1 cName DBS_NAME 2 cType DBS_TYPE 3 nLength DBS_LEN 4 nDecimals DBS_DEC ------------------------------------------------------------------------If there is no database file in USE in the current work area, DBSTRUCT() returns an empty array ({}). |
See also : | AFIELDS() |
DBUNLOCK() --> NIL
DBUNLOCK() releases any record or file locks obtained by the current process for the current work area. DBUNLOCK() is only meaningful on a shared database in a network environment.
DBUNLOCK() performs the same function as the standard UNLOCK command. For more information, refer to the UNLOCK command.
Returns : | DBUNLOCK() always returns NIL. |
See also : | DBUNLOCKALL() FLOCK() RLOCK() |
DBUNLOCKALL() --> NIL
DBUNLOCKALL() releases any record or file locks obtained by the current process for any work area. DBUNLOCKALL() is only meaningful on a shared database in a network environment. It is equivalent to calling DBUNLOCK() on every occupied work area.
DBUNLOCKALL() performs the same function as the UNLOCK ALL command. For more information, refer to the UNLOCK ALL command.
Returns : | DBUNLOCKALL() always returns NIL. |
See also : | DBUNLOCK() FLOCK() RLOCK() |
DBUSEAREA( [<lNewArea>], [<cDriver>], <cName>, [<xcAlias>], [<lShared>], [<lReadonly>]) --> NIL
DBUSEAREA() associates the specified database (.dbf) file with the current work area. It performs the same function as the standard USE command. For more information, refer to the USE command.
<lNewArea> | is an optional logical value. A value of true (.T.) selects the lowest numbered unoccupied work area as the current work area before the use operation. If <lNewArea> is false (.F.) or omitted, the current work area is used; if the work area is occupied, it is closed first. |
<cDriver> | is an optional character value. If present, it specifies the name of the database driver which will service the work area. If |
<cDriver> | is omitted, the current default driver is used (see note below). |
<cName> | specifies the name of the database (.dbf) file to be opened. |
<xcAlias> | is an optional character value. If present, it specifies the alias to be associated with the work area. The alias must constitute a valid xClipper identifier. A valid <xcAlias> may be any legal identifier (i.e., it must begin with an alphabetic character and may contain numeric or alphabetic characters and the underscore). Within a single application, xClipper will not accept duplicate aliases. If <xcAlias> is omitted, a default alias is constructed from |
<cName> | . |
<lShared> | is an optional logical value. If present, it specifies whether the database (.dbf) file should be accessible to other processes on a network. A value of true (.T.) specifies that other processes should be allowed access; a value of false (.F.) specifies that the current process is to have exclusive access. If <lShared> is omitted, the current global _SET_EXCLUSIVE setting determines whether shared access is allowed. |
<lReadonly> | is an optional logical value that specifies whether updates to the work area are prohibited. A value of true (.T.) prohibits updates; a value of false (.F.) permits updates. A value of true (.T.) also permits read-only access to the specified database (.dbf) file. If <lReadonly> is omitted, the default value is false (.F.). |
Returns : | DBUSEAREA() always returns NIL. |
See also : | DBCLOSEAREA() DBSETDRIVER() SELECT() SET() |
DELETED() --> lDeleted
DELETED() is a database function that determines if the current record in the active work area is marked for deletion. Since each work area with an open database file can have a current record, each work area has its own DELETED() value.
By default, DELETED() operates on the currently selected work area. It will operate on an unselected work area if you specify it as part of an aliased expression (see example below).
In applications, DELETED() is generally used to query the deleted status as a part of record processing conditions, or to display the deleted status as a part of screens and reports.
Returns : | DELETED() returns true (.T.) if the current record is marked for deletion; otherwise, it returns false (.F.). If there is no database file in USE in the current work area, DELETED() returns false (.F.). |
See also : | DBDELETE() DBRECALL() |
DESCEND(<exp>) --> ValueInverted
DESCEND() is a conversion function that returns the inverted form of the specified expression to be used with INDEX to create descending order indexes. Specify that part of the index expression you want to be descending as the DESCEND() argument. To subsequently perform a lookup with SEEK, specify DESCEND() in the search expression.
<exp> | is any valid expression of character, date, logical, or numeric type. Memo type is treated in the same way as character type. |
Returns : | DESCEND() returns an inverted expression of the same data type as the <exp>, except for dates which return a numeric value. A DESCEND() of CHR(0) always returns CHR(0). |
EOF() --> lBoundary
EOF() is a database function used to test for an end of file boundary condition when the record pointer is moving forward through a database file. Any command that can move the record pointer can set EOF().
The most typical application is as a part of the <lCondition> argument of a DO WHILE construct that sequentially processes records in a database file. Here <lCondition> would include a test for .NOT. EOF(), forcing the DO WHILE loop to terminate when EOF() returns true (.T.).
EOF() and FOUND() are often used interchangeably to test whether a SEEK, FIND, or LOCATE command failed. With these commands, however, FOUND() is preferred.
When EOF() returns true (.T.), the record pointer is positioned at LASTREC() + 1 regardless of whether there is an active SET FILTER or SET DELETED is ON. Further attempts to move the record pointer forward return the same result without error. Once EOF() is set to true (.T.), it retains its value until there is another attempt to move the record pointer.
By default, EOF() operates on the currently selected work area. It can be made to operate on an unselected work area by specifying it within an aliased expression (see example below).
Returns : | EOF() returns true (.T.) when an attempt is made to move the record pointer beyond the last logical record in a database file; otherwise, it returns false (.F.). If there is no database file open in the current work area, EOF() returns false (.F.). If the current database file contains no records, EOF() returns true (.T.). |
See also : | BOF() FOUND() LASTREC() |
FCOUNT() --> nFields
FCOUNT() is a database function. It is useful in applications containing data-independent programs that can operate on any database file. These include generalized import/export and reporting programs. Typically, you use FCOUNT() to establish the upper limit of a FOR...NEXT or DO WHILE loop that processes a single field at a time.
By default, FCOUNT() operates on the currently selected work area.
Returns : | FCOUNT() returns the number of fields in the database file in the current work area as an integer numeric value. If there is no database file open, FCOUNT() returns zero. |
See also : | AFIELDS() FIELDNAME() TYPE() |
FIELDGET(<nField>) --> ValueField
FIELDGET() is a database function that retrieves the value of a field using its position within the database file structure rather than its field name. Within generic database service functions this allows, among other things the retrieval of field values without use of the macro operator.
<nField> | is the ordinal position of the field in the record structure for the current work area. |
Returns : | FIELDGET() returns the value of the specified field. If <nField> does not correspond to the position of any field in the current database file, FIELDGET() returns NIL. |
See also : | FIELDPUT() |
FIELDNAME/FIELD(<nPosition>) --> cFieldName
FIELDNAME() is a database function that returns a field name using an index to the position of the field name in the database structure. Use it in data-independent applications where the field name is unknown. If information for more than one field is required, use AFIELDS() to create an array of field information or COPY STRUCTURE EXTENDED to create a database of field information.
If you need additional database file structure information, use TYPE() and LEN(). To obtain the number of decimal places for a numeric field, use the following expression:
LEN(SUBSTR(STR(<idField>), RAT(".", ;
STR(<idField>)) + 1))
By default, FIELDNAME() operates on the currently selected work area as shown in the example below.
<nPosition> | is the position of a field in the database file structure. |
Returns : | FIELDNAME() returns the name of the specified field as a character string. If <nPosition> does not correspond to an existing field in the current database file or if no database file is open in the current work area, FIELDNAME() returns a null string (""). |
See also : | AFIELDS() DBSTRUCT() FCOUNT() LEN() VALTYPE() |
FIELDPOS(<cFieldName>) --> nFieldPos
FIELDPOS() is a database function that is the inverse of the FIELDNAME() function. FIELDPOS() is most often used with the FIELDPUT() and FIELDGET() functions.
FIELDPOS() return the names of fields in any unselected work area by referring to the function using an aliased expression. See the example below.
<cFieldName> | is the name of a field in the current or specified work area. |
Returns : | FIELDPOS() returns the position of the specified field within the list of fields associated with the current or specified work area. If the current work area has no field with the specified name, FIELDPOS() returns zero. |
See also : | FIELDGET() FIELDPUT() |
FIELDPUT(<nField>, <expAssign>) --> ValueAssigned
FIELDPUT() is a database function that assigns <expAssign> to the field at ordinal position <nField> in the current work area. This function allows you to set the value of a field using its position within the database file structure rather than its field name. Within generic database service functions this allows, among other things, the setting of field values without use of the macro operator.
<nField> | is the ordinal position of the field in the current database file. |
<expAssign> | is the value to assign to the given field. The data type of this expression must match the data type of the designated field variable. |
Returns : | FIELDPUT() returns the value assigned to the designated field. If <nField> does not correspond to the position of any field in the current database file, FIELDPUT() returns NIL. |
See also : | FIELDGET() |
FLOCK() --> lSuccess
FLOCK() is a database function used in network environments to lock an open and shared database file, preventing other users from updating the file until the lock is released. Records in the locked file are accessible for read-only operations.
FLOCK() is related to USE...EXCLUSIVE and RLOCK(). USE...EXCLUSIVE opens a database file so that no other user can open the same file at the same time and is the most restrictive locking mechanism in xClipper. RLOCK() is the least restrictive and attempts to place an update lock on a shared record, precluding other users from updating the current record. FLOCK() falls in the middle.
FLOCK() is used for operations that access the entire database file. Typically, these are commands that update the file with a scope or a condition such as DELETE or REPLACE ALL. The following is a list of such commands:
Commands that require an FLOCK() ------------------------------------------------------------------------ Command Mode ------------------------------------------------------------------------ APPEND FROM FLOCK() or USE...EXCLUSIVE DELETE (multiple records) FLOCK() or USE...EXCLUSIVE RECALL (multiple records) FLOCK() or USE...EXCLUSIVE REPLACE (multiple records) FLOCK() or USE...EXCLUSIVE UPDATE ON FLOCK() or USE...EXCLUSIVE ------------------------------------------------------------------------
For each invocation of FLOCK(), there is one attempt to lock the database file, and the result is returned as a logical value. A file lock fails if another user currently has a file or record lock for the same database file or EXCLUSIVE USE of the database file. If FLOCK() is successful, the file lock remains in place until you UNLOCK, CLOSE the DATABASE, or RLOCK().
By default, FLOCK() operates on the currently selected work area as shown in the example below.
Returns : | FLOCK() returns true (.T.) if an attempt to lock a database file in USE in the current work area succeeds; otherwise, it returns false (.F.). For more information on file locking, refer to the "Network Programming" chapter in the Programming and Utilities Guide. |
See also : | RLOCK() |
FOUND() --> lSuccess
FOUND() is a database function that determines whether a search operation (i.e., FIND, LOCATE, CONTINUE, SEEK, or SET RELATION) succeeded. When any of these commands are executed, FOUND() is set to true (.T.) if there is a match; otherwise, it is set to false (.F.).
If the search command is LOCATE or CONTINUE, a match is the next record meeting the scope and condition. If the search command is FIND, SEEK or SET RELATION, a match is the first key in the controlling index that equals the search argument. If the key value equals the search argument, FOUND() is true (.T.); otherwise, it is false (.F.).
The value of FOUND() is retained until another record movement command is executed. Unless the command is another search command, FOUND() is automatically set to false (.F.).
Each work area has a FOUND() value. This means that if one work area has a RELATION set to a child work area, querying FOUND() in the child returns true (.T.) if there is a match.
By default, FOUND() operates on the currently selected work area. It can be made to operate on an unselected work area by specifying it within an aliased expression (see example below).
FOUND() will return false (.F.) if there is no database open in the current work area.
Returns : | FOUND() returns true (.T.) if the last search command was successful; otherwise, it returns false (.F.). |
See also : | EOF() |
HEADER() --> nBytes
HEADER() is a database function that is used with LASTREC(), RECSIZE(), and DISKSPACE() to create procedures for backing up files.
By default, HEADER() operates on the currently selected work area. It will operate on an unselected work area if you specify it as part of an aliased expression (see example below).
INDEXEXT() --> cExtension
INDEXEXT() returns the default index file extension by determining which database driver is currently linked. Note that it is preferable to use ORDBAGEXT() than INDEXEXT().
Returns : | Unless you have linked another database driver, INDEXEXT() returns ".ntx" to indicate that the default xClipper driver is in effect. If the dBASE III PLUS compatible database driver is linked, the function returns ".ndx". |
See also : | INDEXKEY() INDEXORD() ORDBAGEXT() |
INDEXKEY(<nOrder>) --> cKeyExp
INDEXKEY() is a database function that determines the key expression of a specified index in the current work area and returns it as a character string. To evaluate the key expression, specify INDEXKEY() as a macro expression like this: &(INDEXKEY(<nOrder>)).
INDEXKEY() has a number of applications, but two specific instances are important. Using INDEXKEY(), you can TOTAL on the key expression of the controlling index without having to specify the key expression in the source code. The other instance occurs within a DBEDIT() user function. Here, you may want to determine whether or not to update the screen after the user has edited a record. Generally, it is only necessary to update the screen if the key expression of the controlling index has changed for the current record. Both of these examples are illustrated below.
By default, INDEXKEY() operates on the currently selected work area. It can be made to operate on an unselected work area by specifying it within an aliased expression (see example below).
<nOrder> | is the ordinal position of the index in the list of index files opened by the last USE...INDEX or SET INDEX TO command for the current work area. A zero value specifies the controlling index, without regard to its actual position in the list. |
Returns : | INDEXKEY() returns the key expression of the specified index as a character string. If there is no corresponding index or if no database file is open, INDEXKEY() returns a null string (""). |
See also : | INDEXEXT() INDEXORD() |
INDEXORD() --> nOrder
INDEXORD() is a database function that determines the position of the controlling index in the list of index files opened by the last USE...INDEX or SET INDEX TO in the current work area. It is often useful to save the last controlling index so it can be restored later.
By default, INDEXORD() operates on the currently selected work area. It will operate on an unselected work area if you specify it as part of an aliased expression (see example below).
Returns : | INDEXORD() returns an integer numeric value. The value returned is equal to the position of the controlling index in the list of open indexes for the current work area. A value of zero indicates that there is no controlling index and records are being accessed in natural order. If no database file is open, INDEXORD() will also return a zero. |
See also : | INDEXKEY() |
LASTREC() | RECCOUNT()* --> nRecords
LASTREC() is a database function that determines the number of physical records in the current database file. LASTREC() is identical to RECCOUNT() which is supplied as a compatibility function.
By default, LASTREC() operates on the currently selected work area. It will operate on an unselected work area if you specify it as part of an aliased expression (see example below).
Note: Although the functionality of RECNO() has been expanded to encompass the concept of "identity," the LASTREC() function continues to return only record numbers--not identities. LASTREC() has no expanded functionality, so it is not "identity-aware."
Returns : | LASTREC() returns the number of physical records in the current database file as an integer numeric value. Filtering commands such as SET FILTER or SET DELETED have no effect on the return value. LASTREC() returns zero if there is no database file in USE in the current work area. |
See also : | EOF() |
LUPDATE() --> dModification
LUPDATE() is a database function that determines the date the database file in the current work area was last modified and CLOSEd. By default, LUPDATE() operates on the currently selected work area. It will operate on an unselected work area if you specify it as part of an aliased expression, as shown in the example below.
Returns : | LUPDATE() returns the date of the last change to the open database file in the current work area. If there is no database file in USE, LUPDATE() returns a blank date. |
See also : | FIELDNAME() LASTREC() RECSIZE() |
ORDBAGEXT() --> cBagExt
ORDBAGEXT() is an order management function that returns a character expression that is the default order bag extension of the current or aliased work area. cBagExt is determined by the RDD active in the current work area.
Returns : | ORDBAGEXT() returns a character expression. |
See also : | ORDBAGNAME() |
ORDBAGNAME(<nOrder> | <cOrderName>) --> cOrderBagName
ORDBAGNAME() is an order management function that lets you access the name of the order bag in which <cOrderName> resides. You may identify the order as a character string or with an integer that represents its position in the order list. In case of duplicate names, ORDBAGNAME() only recognizes the first matching name.
Note: ORDBAGNAME(0) works as ORDBAGNAME(INDEXORD())
<nOrder> | is an integer that identifies the position in the order list of the target order whose order bag name is sought. |
<cOrderName> | is a character string that represents the name of the target order whose order bag name is sought. |
Returns : | ORDBAGNAME() returns a character string, the order bag name of the specific order. |
See also : | ORDBAGEXT() |
ORDLISTADD(<cOrderBagName> [, <cOrderName>]) --> NIL
ORDLISTADD() is an order management function that adds the contents of an order bag, or a single order in an order bag, to the order list. This function lets you extend the order list without issuing a SET INDEX command that, first, clears all the active orders from the order list.
Any orders already associated with the work area continue to be active. If the newly opened order bag contains the only order associated with the work area, it becomes the controlling order; otherwise, the controlling order remains unchanged.
After the new orders are opened, the work area is positioned to the first logical record in the controlling order.
ORDLISTADD() is similar to the SET INDEX command or the INDEX clause of the USE command, except that it does not clear the order list prior to adding the new order(s).
ORDLISTADD() supersedes the DBSETINDEX() function.
The active RDD determines the order capacity of an order bag. The default DBFNTX and the DBFNDX drivers only support single-order bags, while other RDDs may support multiple-order bags (e.g., the DBFCDX driver). When using RDDs that support multiple-order bags, you must explicitly SET ORDER (or ORDSETFOCUS()) to the desired controlling order. If you do not specify a controlling order, the data file will be viewed in first order.
<cOrderBagName> | is the name of a disk file containing one or more orders. You may specify <cOrderBagName> as the file name with or without the path name or appropriate extension. If you do not include the extension as part of <cOrderBagName>, xClipper uses the default extension of the current RDD. |
<cOrderName> | the name of the specific order from the order bag to be added to the order list of the current work area. If you do not specify |
<cOrderName> | , all orders in the order bag are added to the order list of the current work area. |
Returns : | ORDLISTADD() always returns NIL. |
See also : | DBSETINDEX() |
RECCOUNT() | LASTREC() --> nRecords
RECCOUNT() is a database function that is a synonym for LASTREC(). By default, RECCOUNT() operates on the currently selected work area. It will operate on an unselected work area if you specify it as part of an aliased expression (see example below). Note that RECCOUNT() is a compatibility function. LASTREC() should be used in its place.
Returns : | RECCOUNT() returns the number of physical records in the current database file as an integer numeric value. Filtering commands such as SET FILTER or SET DELETED have no affect on the return value. RECCOUNT() returns zero if there is no database file open in the current work area. |
See also : | EOF() LASTREC() |
RECNO() --> Identity
RECNO() is a database function that returns the identity found at the current position of the record pointer. Identity is a unique value guaranteed by the structure of the data file to reference a specific record of a data file. The data file need not be a traditional Xbase file. Therefore, unlike earlier versions of xClipper, the value returned need not be a numeric data type.
Under all RDDs, RECNO() returns the value at the position of the record pointer; the data type and other characteristics of this value are determined by the content of the accessed data and the RDD active in the current work area. In an Xbase database this value is the record number.
RECSIZE() --> nBytes
RECSIZE() is a database function that determines the length of a record by summing the lengths of each field then adding one for the DELETED() status flag. When this value is multiplied by LASTREC(), the product is the amount of space occupied by the file's records.
RECSIZE() is useful in programs that perform automatic file backup. When used in conjunction with DISKSPACE(), the RECSIZE() function can assist in ensuring that sufficient free space exists on the disk before a file is stored.
By default, RECSIZE() operates on the currently selected work area. It will operate on an unselected work area if you specify it as part of an aliased expression (see example below).
Returns : | RECSIZE() returns, as a numeric value, the record length in bytes of the database file open in the current work area. RECSIZE() returns zero if no database file is open. |
See also : | FIELDNAME() HEADER() LASTREC() |
RLOCK() --> lSuccess
RLOCK() is a network function that locks the current record, preventing other users from updating the record until the lock is released. RLOCK() provides a shared lock, allowing other users read-only access to the locked record while allowing only the current user to modify it. A record lock remains until another record is locked, an UNLOCK is executed, the current database file is closed, or an FLOCK() is obtained on the current database file.
For each invocation of RLOCK(), there is one attempt to lock the current record, and the result is returned as a logical value. An attempt to obtain a record lock fails if another user currently has a file or record lock on that particular record, or EXCLUSIVE USE of the database file. An attempt to RLOCK() in an empty database returns true (.T.).
By default, RLOCK() operates on the currently selected work area. It will operate on an unselected work area if you specify it as part of an aliased expression (see example below). This feature is useful since RLOCK() does not automatically attempt a record lock for related files.
As a general rule, RLOCK() operates solely on the current record. This includes the following commands:
@...GET
DELETE (single record)
RECALL (single record)
REPLACE (single record)
Refer to the "Network Programming" chapter in the Programming and Utilities Guide for more information.
Returns : | RLOCK() returns true (.T.) if the record lock is obtained; otherwise, it returns false (.F.). |
See also : | FLOCK() |
SELECT([<cAlias>]) --> nWorkArea
SELECT() is a database function that determines the work area number of an alias. The number returned can range from 0 to 250. If <cAlias> is not specified, the current work area number is returned. If <cAlias> is specified and the alias does not exist, SELECT() returns zero.
Note: The SELECT() function and SELECT command specified with an extended expression argument look somewhat alike. This should not be a problem since the SELECT() function is not very useful on a line by itself.
USED() --> lDbfOpen
USED() is a database function that determines whether there is a database file in USE in a particular work area. By default, USED() operates on the currently selected work area. It will operate on an unselected work area if you specify it as part of an aliased expression.