minp()

Read(1725) Label: sequence, minimum value,

Here’s how to use minp() function.

A .minp()

Description:

Get the member that makes the minimum value for the expression.

Syntax:

A.minp(x)

Note:

The function computes expression x with each member of sequence A and returns the member which makes the minimum value for the expression x.

Option:

@a

Return all the members that fulfill the condition. By default, return the first eligible member

@z

Search the member from back to front

Parameter:

A

A sequence

x

An expression that by default returns the first member of A

Return value:

Single value or sequence

Example:

When A is a sequence:

 

A

 

1

[2,5,6,3,2,3]

 

2

=A1.minp(~*~)

2; return members of A1 that make the expression get the smallest value; by default, return only the first eligible member

3

=A1.minp@a(~*~)

[2,2]; as @a option is present, return all members that make the expression get the smallest value

4

=A1.minp@z(~*0)

3; search from front to back

5

=A1.minp()

2; return the first member of A1 as parameter x is absent

 

  When A is a table sequence or a record sequence:

 

A

 

1

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

2

=A1.minp@a(BIRTHDAY)

返回年龄最大的员工信息

3

=A1.minp()

返回A1中的第一条记录

 

Related function:

A.pmin()

A.maxp()