FClose()
FCount()
FCreate()
FErase()
FError()
FieldBlock()
FieldName()
FieldPos()
FieldPut()
AFields | Fills referenced arrays with database field information |
Alias | Returns the alias name of a work area |
BOF | Test for the beggining-of-file condition |
dbAppend | Appends a new record to a database file |
dbClearFilter | Clears the current filter condiction in a work area |
dbCloseAll | Close all open files in all work areas. |
dbCloseArea | Close a database file in a work area |
dbCommit | Updates all index and database buffers for a given workarea |
dbCommitAll | Flushes the memory buffer and performs a hard-disk write |
dbCreate | Creates an empty database from a array |
dbDelete | Mark a record for deletion in a database |
dbEval | Performs a code block operation on the current Database |
DBF | Alias name of a work area |
dbFilter | Return the filter expression in a work area |
dbGoBottom | Moves the record pointer to the bottom of the database |
dbGoto | Position the record pointer to a specific location |
dbGoTop | Moves the record pointer to the top of the database |
dbRecall | Recalls a record previousy marked for deletion |
dbSeek | Searches for a value based on an active index |
dbSelectArea | Change to another work area |
dbSetDriver | Establishes the RDD name for the selected work area |
dbSetFilter | Establishes a filter condition for a work area |
dbSkip | Moves the record pointer in the selected work area |
dbSkipper | Helper function to skip a database |
dbStruct | Builds a multidimensional array of a database structure |
dbUseArea | Opens a work area and uses a database file |
Deleted | Tests the record’s deletion flag |
EOF | Test for end-of-file condition |
FCount | Counts the number of fields in an active database |
FieldDeci | Determines the number of decimal places of a given numeric field |
FieldGet | Obtains the value of a specified field |
FieldName | Return the name of a field at a numeric field location |
FieldPos | Return the ordinal position of a field |
FieldPut | Set the value of a field variable |
FieldSize | Determines the size of a given field |
FieldType | Determines the type of a given field |
Found | Determine the success of a previous search operation |
Header | Return the length of a database file header |
LastRec | Returns the number of records in an active work area or database |
LUpdate | Yields the date the database was last updated |
RecCount | Counts the number of records in a database |
RecNo | Returns the current record number or identity |
RecSize | Returns the size of a single record in an active database |
Select | Returns the work area number for a specified alias |
Used | Checks whether a database is in use in a work area |
FIELDTYPE() Determines the data type for a field Syntax FIELDTYPE(<nField>) --> cType Argument <nField> Designates the data field for which the data type is determined. Returns FIELDTYPE() returns a single character that designates the data type of the data field (assuming the data field number is valid). FIELDTYPE() returns the following characters for the various data field types: Table 10-1: Coding for Data Field Types ------------------------------------------------------------------------ Character Data Type ------------------------------------------------------------------------ C Character string N Numeric D Date L Logical M MEMO ------------------------------------------------------------------------ Description FIELDTYPE() operates in a similar fashion to the CA-Clipper TYPE() function. With TYPE(), you must always know only the name of the data field. However, FIELDTYPE() requires that you only know the data field, not its name. Use the function to confirm data types for data fields when a program is working with different databases that have different field names. Note . If there are invalid data field numbers, the function returns a null string. Example Data type for field number 5: IF FIELDTYPE(5) = "C" ? "Field No. 5 is a character field!" ENDIF
See Also: FCOUNT, FIELDNUM, FIELDNAME, FIELDSIZE, FIELDDECI, DBF Structure
FIELDSIZE() Determines the size of a field ------------------------------------------------------------------------------ Syntax FIELDSIZE(<nField>) --> nLength Argument <nField> Designates the number of the field to evaluate. Returns FIELDSIZE() returns a numeric value that corresponds to the field length of a valid field number. Description Use FIELDSIZE() to determine the length (or size) of data field of desired data types. This determines the window width needed for output to appear without a line break, or the length needed for an input to automatically fit in the database. Note . If there is an invalid data field number, the function returns a value of 0. Example Determine the total length of fields 3 to 5: nLength := 0 FOR I = 3 TO 5 nLength := nLength + FIELDSIZE() NEXT
See Also: FCOUNT, FIELDNUM, FIELDNAME, FIELDTYPE, FIELDDECI, PAD, STR, DBF Structure
FIELDNUM() Determines the field number for a specific field in a database file ------------------------------------------------------------------------------ Syntax FIELDNUM(<cFieldName>) --> nFieldNumber Argument <cFieldName> Designates to the field name. Returns FIELDNUM() returns the number of the data field. Description FIELDNUM() is the exact opposite of the CA-Clipper FIELD() function. Use this function when you need a data field number instead of the data field name. FIELDNUM() determines if a symbol name pertains to a data field or a memory variable (see Examples). Note . If a data field with the name <cFieldName> is not available, the function returns a value of 0. Example Is it a field or a variable? IF FIELDNUM("cName") > 0. REPLACE cName WITH UPPER(cName). ELSE. cName := UPPER(cName). ENDIF
See Also: FCOUNT, FIELDNAME, FIELDTYPE, FIELDSIZE, FIELDDECI, PAD, STR, DBF Structure
How I can obtain structure info of a DBF ?
PROC MAIN() SETMODE( 25, 80 ) CLS USE ..\datas\TEST1 ? "No Field Name T Size Dec" ? "-- ------------ - ----- ---" FOR nFld := 1 TO FCOUNT() * or : FIELDNUM( FIELDNAME( nFld ) ? STR( nFld, 2, 0 ),; // CT Database Function PAD( FIELDNAME( nFld ), 12 ),; // Standard dBASE function FIELDTYPE( nFld ),; // CT Database Function STR( FIELDSIZE( nFld ), 5, 0 ),; // CT Database Function STR( FIELDDECI( nFld ), 3, 0 ) // CT Database Function NEXT nFld ? WAIT "EOF DBF_Struct.prg" RETURN // MAIN.DBF_Struct.prg"
FIELDDECI() Determines the number of decimal places in a field ------------------------------------------------------------------------------ Syntax FIELDDECI(<nField>) --> nDecimalPlaces Argument <nField> Designates for which numeric data field to determine the number of decimal places. Returns When a field number is valid, FIELDDECI() returns the number of decimal places in a numeric data field. Description It is important to know how many decimal places are in a data field so you can limit the input of significant digits in the corresponding number. FIELDDECI() determines the number of decimal places available. This allows you to tailor inputs to the database without changing the program. Note . If you have an invalid field number, the function returns a value of 0. Example Convert the second field to a string with the correct number of decimal places: @ 0, 60 SAY "Price: " + STR(cField2, 8, FIELDDECI(2))
See Also: FCOUNT, FIELDNUM, FIELDNAME, FIELDTYPE, FIELDSIZE, DBF Structure
Introduction Database Functions DBFDSKSIZE() Determines the size of a selected (.dbf) file on a disk drive DBFSIZE() Determines the size of a selected (.dbf) file in memory FIELDDECI() Determines the number of decimal places in a field FIELDNUM() Determines field number for a specific field in a database file FIELDSIZE() Determines the size of a field FIELDTYPE() Determines the data type for a field ISDBT() Determines if a memo file (.dbt) is present