Computes the number of records/elements in the specified field or array.
You can also give a condition which records of the field should be included.
Count( fld ) Count( fld, condFld ) Count( fld, condFld, cond ) Count( array )
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. |
Numeric value of the number of elements in the field or array.
//counts the values of the array count([1,2,3,4,5,6,7,8]) //returns 8
//counts the values of the database field ProductId count({Products.ProductId})
//counts the value of the prompt field //returns 1 if p is a single value prompt and >1 if p is a multi value prompt count({?p})
//counts the sales grouped by vendors count({Sales.Sales_Amount}, {Vendors.VendorId})
//a formula whose result depends on count of all sales of vendors (Crystal Syntax) if count({Sales.Sales_Amount}, {Vendors.VendorId}) > {?p} then red else black
Engine.addGroup
.
if isnull(fld) then ruledout else fld
replace fld with the field you want to create a count on and replace ruledout with a value which will not appear in the data, e.g. -1 or -100 000 000 000