max()

Read(2019) Label: compute, maximum value,

Description:

Find the maximum value among members of a sequence.

Syntax:

A.max(x)

 

max(x1,…,xn)

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

Note:

The function computes expression x with members of sequence A and returns the maximum member value.

Parameter:

A

A sequence, where members should have same data type

x

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

Return value:

The maximum value

Example:

When A is a sequence:

 

A

 

1

=[8,-6,1,3,5].max()

8.

2

=["c","b",null,"e","A"].max()

"e".

3

=["a",1].max()

Error is reported as members of the sequence have inconsistent data types.

4

=[8,-6,1,3,5].max(~*10)

80; return the maximum member value after expression is computed.

5

=max(8,-6,1,3,5)

8; which is same as A1.

When A is a table sequence or a record sequence:

 

A

 

1

=demo.query("select EID,NAME,SALARY from EMPLOYEE").sort(SALARY:-1)

Query content of EMPLOYEE table and sort result by SALARY in descending order.

2

=A1.max(SALARY+1000)

Get the highest SALARY value after salary is increased by 1000 and return 17,000.