min()

Read(2057) Label: minimum value,

Description:

find the minimum value among members of a sequence.

Syntax:

A.min(x)

 

min(x1,…,xn)

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

Note:

The function computes expression x with members of sequence A and by default, returns the minimum non-null value.

Parameter:

A

A sequence, where members should have same data type.

x

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

Option:

@0

Do not ignore null members; syntax min(x1,…,xn) isn’t supported when this option works.

Return value:

The minimum value  

Example:

When A is a sequence:

 

A

 

1

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

"A"

2

=[8,-6,1,3,5].min(~*2)

-12

3

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

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

4

=["a",null,"b"].min()

"a"; ignore null members.

5

=["a",null,"b"].min@0()

null.

6

=min("c","b","e","A")

"A", 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)

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

2

=A1.min(SALARY+1000)

Get the lowest SALARY value after salary is increased by 1000 and return 4000.

3

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

Query AREA table.

4

=A3.min(FATHER)

Get the minimum non-null FATHER value in AREA table and return 0.