QFLDSTYPE()
Short:
------
QFLDSTYPE() Count # of fields of a given type or types
Returns:
--------
<nCount> => number of fields of the specified type(s)
Syntax:
-------
QFLDSTYPE(cTypes)
Description:
------------
<cTypes> is a string containing one or more field
type symbols
Valid symbols are:
C character
N numeric
L logical
D date
M memo
If no fields of the specified type(s) exist, 0 will
be returned
Examples:
---------
nMemos := QFIELDSTYPE("M") // number of memo fields
nNums := QFIELDSTYPE("N") // number of numeric fields
nNums := QFIELDSTYPE("LD") // number of date and logical fields
Source:
-------
S_AFTYPE.PRG
See also : AFIELDSTYPE()
Tag Archives: COUNT
SP_DBSTATS
DBSTATS() Short: ------ DBSTATS() Statistical report on dbf, including sum/avg/min/max/std/var/count Returns: -------- Nothing Syntax: ------- DBSTATS() Description: ------------ This is a point & shoot metafunction which allows the user to get statistical data on a dbf, particularly with numeric fields. Statistics available are: count, sum, average, minimum, maximum, variance and standard deviation. the analysis may also be based on a conditional criteria. Examples: --------- use (cDbfName) DBSTATS() // its a menu driven metafunction Source: ------- S_DBSTAT.PRG
SP_AKOUNT
AKOUNT() Short: ------ AKOUNT() Counts exact matches of value in array Returns: -------- <nMatches> => Number of matches Syntax: ------- AKOUNT(aTarget,expWhatever) Description: ------------ Counts # of exact matches of <expWhatever> in <aTarget>. <expWhatever> can be of any type. Examples: --------- AFIELDS(aFields,aTypes) nChar := AKOUNT(aTypes,"C") // count C fields nNum := AKOUNT(aTypes,"N") // count N fields nDate := AKOUNT(aTypes,"D") // count D fields Notes: ------- See also AMATCHES() which allows a code block. Source: ------- S_AKOUNT.PRG
C5_COUNT
COUNT
Tally records to a variable
------------------------------------------------------------------------------
Syntax
COUNT TO <idVar>
[<scope>] [WHILE <lCondition>] [FOR <lCondition>]
Arguments
TO <idVar> identifies the variable that holds the COUNT result. A
variable that either does not exist or is invisible is created as a
private variable whose scope is the current procedure.
<scope> is the portion of the current database file to COUNT. The
default is ALL records.
WHILE <lCondition> specifies the set of records meeting the
condition from the current record until the condition fails.
FOR <lCondition> specifies the conditional set of records to COUNT
within the given scope.
Description
COUNT tallies the number of records from the current work area that
match the specified record scope and conditions. The result is then
placed in the specified variable. <idVar> can be a variable of any
storage class including a field.
Examples
. This example demonstrates a COUNT of Branches in Sales.dbf:
USE Sales NEW
COUNT TO nBranchCnt FOR Branch = 100
? nBranchCnt // Result: 4
. This example tallies the number of records in Sales.dbf whose
Branch has the value of 100 and assigns the result to the Count field
in Branch.dbf for branch 100:
USE Branch INDEX Branch NEW
SEEK 100
USE Sales INDEX SalesBranch NEW
SEEK 100
COUNT TO Branch->Count WHILE Branch = 100
Files Library is CLIPPER.LIB.
See Also: AVERAGE DBEVAL() SUM TOTAL
Clipper and Networking
The secrets of array handling, part 1.
C5 Database Commands
Database Commands and Statements
APPEND BLANK :
Add a new record to current database file.
APPEND BLANK
APPEND FROM :
Import records from a (.dbf) or ASCII file
APPEND FROM <xcFile>
[FIELDS <idField list>]
[<scope>]
[WHILE <lCondition>]
[FOR <lCondition>]
[SDF | DELIMITED [WITH BLANK | <xcDelimiter>] |
[VIA <xcDriver>]]
AVERAGE :
Average numeric expressions in the current work area
AVERAGE <nExp list> TO <idVar list>
[<scope>]
[WHILE <lCondition>]
[FOR <lCondition>]
CLEAR ALL* :
Close files and release public and private variables.
CLEAR ALL
CLOSE :
Close a specific set of files
CLOSE [<idAlias> | ALL | ALTERNATE | DATABASES | FORMAT |INDEXES ]
COMMIT :
Perform a solid-disk write for all active work areas
COMMIT
CONTINUE :
Resume a pending LOCATE
CONTINUE
COPY STRUCTURE :
Copy the current (.dbf) structure to a new (.dbf) file
COPY STRUCTURE [FIELDS <idField list>] TO <xcDatabase>
COPY STRUCTURE EXTENDED :
Copy field definitions to a (.dbf) file
COPY STRUCTURE EXTENDED TO <xcExtendedDatabase>
COPY TO :
Export records to a new (.dbf) or ASCII file
COPY [FIELDS <idField list>] TO <xcFile>
[<scope>]
[WHILE <lCondition>]
[FOR <lCondition>]
[SDF | DELIMITED [WITH BLANK | <xcDelimiter>] |
[VIA <xcDriver>]]
COUNT :
Tally records to a variable
COUNT TO <idVar>
[<scope>]
[WHILE <lCondition>]
[FOR <lCondition>]
CREATE :
Create an empty structure extended (.dbf) file
CREATE <xcExtendedDatabase>
CREATE FROM :
Create a new (.dbf) file from a structure extended file
CREATE <xcDatabase>
FROM <xcExtendedDatabase>
[NEW]
[ALIAS <xcAlias>]
[VIA <cDriver>]
DELETE :
Mark records for deletion
DELETE [<scope>]
[WHILE <lCondition>]
[FOR <lCondition>]
FIELD :
Declare database field names
FIELD <idField list> [IN <idAlias>]
FIND* :
Search an index for a specified key value
FIND <xcSearchString>
GO :
Move the record pointer to a specific record
GO[TO] <nRecord> | BOTTOM | TOP
JOIN :
Merge two (.dbf) files to create a new (.dbf) file
JOIN WITH <xcAlias> TO <xcDatabase>
FOR <lCondition>
[FIELDS <idField list>]
LOCATE :
Search sequentially for a record matching a condition
LOCATE [<scope>]
FOR <lCondition>
[WHILE <lCondition>]
PACK :
Remove deleted records from a database file
PACK
RECALL :
Restore records marked for deletion
RECALL [<scope>]
[WHILE <lCondition>]
[FOR <lCondition>]
REPLACE :
Assign new values to field variables
REPLACE <idField> WITH <exp>
[, <idField2> WITH <exp2>...]
[<scope>]
[WHILE <lCondition>]
[FOR <lCondition>]
SEEK :
Search an index for a specified key value
SEEK <expSearch>
SELECT :
Change the current work area
SELECT <xnWorkArea> | <idAlias>
SET DELETED :
Toggle filtering of deleted records
SET DELETED on | OFF | <xlToggle>
SET EXCLUSIVE :
Establish shared or exclusive USE of database files
SET EXCLUSIVE ON | off | <xlToggle>
SET FILTER :
Hide records not meeting a condition
SET FILTER TO [<lCondition>]
SET MEMOBLOCK :
Change the block size for memo files
SET MEMOBLOCK TO <nSize>
SET PATH :
Specify the search path for opening files
SET PATH TO [<xcPathspec list>]
SET RELATION :
Relate two work areas by a key value or record number
SET RELATION TO [<expKey> | <nRecord> INTO <xcAlias>]
[, [TO] <expKey2> | <nRecord2> INTO <xcAlias2>...]
[ADDITIVE]
SET SOFTSEEK :
Toggle relative SEEKing
SET SOFTSEEK on | OFF | <xlToggle>
SET UNIQUE :
Toggle the inclusion of nonunique keys into an index
SET UNIQUE on | OFF | <xlToggle>
SKIP :
Move the record pointer to a new position
SKIP [<nRecords>] [ALIAS <idAlias> | <nWorkArea>]
SORT :
Copy to a (.dbf) file in sorted order
SORT TO <xcDatabase> ON <idField> [/[A | D][C]]
[, <idField2> [/[A | D][C]]...]
[<scope>]
[WHILE <lCondition>]
[FOR <lCondition>]
SUM :
Sum numeric expressions to variables
SUM <nExp list> TO <idVar list>
[<scope>]
[WHILE <lCondition>]
[FOR <lCondition>]
TOTAL :
Summarize records by key value to a (.dbf) file
TOTAL ON <expKey> FIELDS <idField list>
TO <xcDatabase>
[<scope>]
[WHILE <lCondition>]
[FOR <lCondition>]
UNLOCK :
Release file/record locks set by the current user
UNLOCK [ALL]
UPDATE :
Update current database file from another database file
UPDATE FROM <xcAlias> ON <expKey> [RANDOM] REPLACE <idField> WITH <exp> [, <idField2> WITH <exp2>...]
USE :
Open an existing (.dbf) and its associated files
USE [<xcDatabase>
[INDEX <xcIndex list>]
[ALIAS <xcAlias>]
[EXCLUSIVE | SHARED]
[NEW] [READONLY]
[VIA <cDriver>]]
ZAP :
Remove all records from the current database file
ZAP