Basic Syntax CrystalClear Syntax Before Reading Records

DistinctCount( fld )
DistinctCount( fld, condFld )
DistinctCount( fld, condFld, cond )
DistinctCount( array )


Returns the count of distinct values for a field or an array.

Usage:

DistinctCount( fld )
DistinctCount( fld, condFld )
DistinctCount( fld, condFld, cond )
DistinctCount( array )

Parameters:

fld The name of a field whose values should be counted.
condFld The name of the field that groups the values of fld (if fld isn't an array).
cond A string declaring the type of grouping to be used on condFld. This only makes sense for groups based on Date, DateTime, Time, and Boolean fields. See Summary Field Conditions for a list of strings you can use here.
array The name of an array variable whose elements should be counted.

Returns:

Numeric value of the amount of distinct values in the field or array.

Examples:

//counts the distinct values of the array
DistinctCount([1,4,2,4,3,2,1,7]) //returns 5
//counts the distinct values of the database field Users.Name
DistinctCount({Users.Name})
//counts the distinct value of the prompt field
DistinctCount({?p}) //returns 4 if p is a multi value prompt with values (0,1,2,2,4)
//counts the distinct products grouped by vendors
DistinctCount({Products.ProductName}, {Vendors.VendorId})
//a formula whose result depends on count of all distinct sales of vendors (Crystal Syntax)
DistinctCount({Products.ProductName}, {Vendors.VendorId}) > {?p}

Notes:

See also:


i-net software strives to provide accurate product documentation. Please give us your feedback using the form below.
NOTE: This form is for documentation feedback only. For technical assistance, please send an email to crystalclear@inetsoftware.de.

This page is: very poor very good
Comment: