$count

Counts the number of set members that meet a specified condition, excluding records in which the condition is $Null.

Syntax

$count(expression)

Parameters

expression

is any expression

Return Value

Number, with no decimal places.

Comments

Expression is often a WHERE expression that includes only selected set members in the counting operation. If the WHERE expression (expr1 WHERE expr2) is true, then the member containing expr1 is included in the running count; otherwise, expression is considered $Null and is not included in the running count.

Example

compute Employees where DeptName="Sales" \
  evaluate (let EmpsInSales = $count(LastName where LastName = "Smith"))

First finds all employees in the sales department, then counts the number of Smiths among those employees.

add Employees from TestData let EmpNum = ($count("")+1000)

As employee data is added, each new record is counted. New employee records are assigned unique employee numbers in sequence, based on the current value of $count plus 1000.

 

Related Topics