DistinctCount

DistinctCount(Number a[ ])

This function computes the number of distinct values in an array.

Parameter

a - A Number array.

Return value

The return value is an Integer.

Example

The return value of the following statement is 4.

DistinctCount([1.45, 2.63, 38.1, 1.45, 23.9])

DistinctCount(DBField a)

This function computes the number of distinct values referred to by a DBField.

Parameter

a - Values of a DBField or a formula field.

Return value

The return value is an Integer.

Example

If you build a report about customer order, the return value of the following statement is 19.

DistinctCount(@"Order Date")

DistinctCount(DBField a, String groupby)

This function is used to count the number of distinct values referred to by the first argument.

Parameters

Return value

Returns a Number type value.

Examples

Note: If a field is assigned to a variable, for example x, the variable x will lose the characteristic of representing a group of values. The following formula will be treated as incorrect.

Number x = @dbfield;
Number y = DistinctCount(x); // system will prompt you that there is no such kind of function.