pmax()

Read(2915) Label: maximum value, position,

Here’s how to use pmax() function.

A.p max()

Description:

Get the positions of members with the maximum value in a sequence.

Syntax:

A.pmax(x)

Note:

The function computes expression x with each member of sequence A and returns the sequence numbers of the members whose computations are the maximum. Can be used to find positions of the maximum value in a sequence.

Parameter:

A

A sequence

x

A field name or an expression, in which "~" is used to reference the current record.

Option:

@a

Return sequence numbers of all members that make expression x get the largest value. When omitted, only return the sequence number of the first member

@z

Perform the search backwards from the last member; by default, perform the search from the first member

Return value:

Sequence number/Sequence composed of sequence numbers

Example:

 

A

 

1

[2,5,4,3,2,9,4,9,3]

 

2

=A1.pmax(~*~)

6

3

=A1.pmax@a(~*~)

[6,8]

4

=A1.pmax@z(~*~)

8

5

=A1.pmax@az(~*~)

[8,6]

6

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

 

7

=A6.pmax(BIRTHDAY)

472

Related function:

A.maxp()

A.pmin()