# max()

Read（410） Label: max,

Here’s how to use max() function.

## A .max()

Description:

Compute the maximum value of all the non-null members in a sequence.

Syntax:

 A.max() Equivalent to max(x1,…,xn)

Note:

The function computes the maximum value of all the non-null members in sequence A. Note that this function doesn’t apply to a sequence whose members are not of the same data type.

Parameters:

 A A sequence

Return value:

The maximum value of all members in sequence A

Example:

 A 1 =[8,-6,1,3,5].max() 8 2 =["c","b","e","A"].max() "e" 3 =["a",1].max() Error message is displayed because the members are of different data types 4 =["a",null,"b"].max() "b" 5 =max(8,-6,1,3,5) 8

Related functions:

## A .max( x )

Description:

Compute x with each member of the sequence and then find the maximum value of the members of the new sequence.

Syntax:

 A.max(x) Equivalent to A.(x).max()

Note:

The function loops through members of sequence A and returns the maximum value among members of the new sequence.

Parameters:

 A A sequence x Generally an expression of a single field name, or a legal expression composed of multiple field names

Return value:

The maximum value of members of a new sequence obtained by performing computations on members of sequence A.

Example:

 A 1 =demo.query("select * from EMPLOYEE") 2 =A1.max(SALARY) Compute the highest salary 3 =A1.(SALARY+100).max() Add 100 to the salary of each employee and then compute the highest salary

Related functions: