pmax()

Read(2546) Label: maximum value, position,

Here’s how to use pmax() function.

A .pmax()

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 ordinal 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 ordinal numbers of all members that make expression x get the largest value. When omitted, only return the ordinal 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:

Ordinal number/Sequence composed of ordinal 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()