cand()

Description:

Perform the logical AND operation over members of a sequence.

Syntax:

A.cand(x)

 

cand(x1,…,xn)

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

Note:

The function performs a logical AND operation and returns true when expression x is true with all members of sequence A; otherwise, it returns false.

 

Operators in a logical operation is Boolean type; will automatically convert to Boolean type if they are not.

Parameter:

A

A sequence.

x

An expression; cannot be omitted when sequence A is a table sequence or a record sequence.

Return value:

Boolean

Example:

When A is a sequence:

 

A

 

1

=[2<10,3>4,1!=1]

Return members true, false, false.

2

=A1.cand()

false.

3

=[1==1,1<2].cand()

true.

4

=[20,1<2].cand()

true; automatically convert to Boolean when an operator isn’t Boolean type.

5

=[null,1<2].cand()

false.

6

=cand(null,1<2)

False, which is same as A5.

 

When A is a table sequence or a record sequence:

 

A

 

1

=demo.query("select top 10 EID,NAME,GENDER,DEPT from EMPLOYEE")

2

=A1.cand(DEPT)

Judge whether DEPT values in table sequence A1 are true and return true.

3

=A1.cand(GENDER=="F")

Judge whether DEPT values in table sequence A1 are “F” and return false.