count()

Read(2042) Label: sequence, non-null member, integer,

Description:

Count the number of members of a sequence.

Syntax:

A.count(x)

 

count(x1,…,xn )

Equivalent to A.count (), where x1,…,xn are members of sequence A

Note:

The function computes expression x with members of sequence A and returns the number of non-null members.

Parameter:

A

A sequence

x

An expression; can be omitted

Return value:

Integer

Example:

When A is a sequence:

 

A

 

1

=[1,2,3,"w"].count()

4.

2

=[1,null,3,4].count()

3; ignore null members.

3

=[1,null,3,4].count(~|0)

4; piece zero together with members of the given sequence and return number of non-null members.

4

=count(1,null,3,4)

3, which is same as A2.

When A is a table sequence or a record sequence:

 

A

 

1

=demo.query("select top 10 * from AREA ")

2

=A1.count()

Find number of records in table sequence A1 and return 10.

3

=A1.count(FATHER)

Find number of records where FATHER value is non-null in table sequence A1 and return 9.