$count

$count

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

$count

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

Syntax

$count(expression)

Parameters

expressionis 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.

See Also

$average

$max

$min

$total

About Character Literals

About Functional Expressions

WHERE

Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Leave a Reply

Your email address will not be published. Required fields are marked *

en_CAEnglish