Description:
Compute expression x over sequence A and return members of A that makes expression x get the greatest value.
Syntax:
A.maxp(x)
Note:
The function computes expression x with each member of sequence A and returns the member which makes the maximum value for expression x.
Option:
@a |
Return all the members that fulfill the condition; by default, return the first one. |
@z |
Search the member from back to front. |
Parameters:
A |
A sequence. |
x |
An expression that by default returns the last member of sequence A. |
Return value:
Single value or sequence
Example:
When parameter A is a sequence
|
A |
|
1 |
[6,2,5,6,3,2] |
|
2 |
=A1.maxp(~*~) |
6; return A1’s members that make the expression get the greatest value; by default, only the first eligible member is returned. |
3 |
=A1.maxp@a(~*~) |
[6,6]; with @a option, return all members that make the expression get the greatest value. |
4 |
=A1.maxp@z(~*0) |
2; search backwards. |
5 |
=A1.maxp() |
2; as parameter x is absent, return the last member of A1. |
When parameter A is a table sequence or a record sequence
|
A |
|
1 |
=demo.query("select top 10 EID,NAME,BIRTHDAY from EMPLOYEE") |
|
2 |
=A1.maxp@a(BIRTHDAY) |
Return record of the youngest employee:
|
3 |
=A1.maxp() |
Return the last record of A1:
|
Related function: