### Count (fld), Count (fld, condFld), Count (fld, condFld, cond), Count (x)

Basic and Crystal syntax.

##### Arguments

- fld is any valid database or formula field that can be evaluated by the function.
- condFld is a field used to group the values in fld by.
- cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
- x is an array of values that can be evaluated by the function being used.

##### Returns

Fractional Number

##### Action

Enables you to count the values that appear in your report (for a specified field). For example:

- If a sales report includes all orders made and the amount of each order, you can compute the total number of orders that appear on the report (a grand total count). For information on this kind of counting, see SummaryFunction (fld).
- If you break orders into groups (for example, orders grouped by the state that they come from), you can compute the number of orders per group (in this case, per state). For information on this kind of counting, see SummaryFunction (fld, condFld).
- If you break orders into date or Boolean groups (for example, orders grouped by the month in which they were placed), you can compute the number of orders per group based on a particular change in the date or Boolean field (in this case, per month). For information on this kind of counting, see SummaryFunction (fld, condFld, cond).
- If you specify a set of individual values, you can compute the number of values in the set. For information on this kind of counting, see Array summary functions (x).

##### Examples

The following examples are applicable to both Basic and Crystal syntax:

`Count({orders.AMOUNT}, {orders.CUSTOMER ID})`

This formula counts the number of orders in each group of orders in the Amount field (the total orders for each month). The orders are separated into groups whenever the value in the Customer ID field changes.

`Count({orders.ORDER AMOUNT}, {orders.ORDER DATE}, "monthly")`

Counts the number of orders in each group of orders in the Amount field (the total orders for each month). The orders are separated into groups whenever the value in the Date field changes to a new month.

The following examples are applicable to Crystal syntax:

If Count({orders.ORDER ID}) >= 100 Then
"Congratulations on meeting your quota!"
Else
""

Prints the congratulatory message if the number of orders is 100 or more, and prints nothing if the number of orders is less than 100.

`Count([1,2,3,4,5])`

Returns 5. Counts the total number of values in the array.

Note: Using this function in a formula forces the formula to be evaluated at print time.

For more information on evaluation time considerations, see Evaluation Time functions.

Seagate Software, Inc. http://www.seagatesoftware.com Please send comments to: techpubs@seagatesoftware.com