{{sidenavigation.sidenavigationExpandLabel}}
{{getMsg('Help_YouAreHere')}}: {{page.title}} {{page.title}}
{{$root.getMsg("downLoadHelpAsPdf")}} {{helpModel.downloadHelpPdfDataStatus}}

Count

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.

Usage:

Count( fld )
Count( fld, condFld )
Count( fld, condFld, cond )
Count( 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 number of elements in the field or array.

Examples:

//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

Notes:

  • If the values in fld should be grouped, a group based on condFld is needed. If the group does not exist in the report, you can add it using i-net Designer or using API method: Engine.addGroup.
  • NULL values will not be counted. The function returns 0, if fld contains only NULL values.
    As workaround you could compute the count of the following formula:
      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

i-net Clear Reports
This application uses cookies to allow login. By continuing to use this application, you agree to the use of cookies.


Help - Count