pmax()

Read(237) 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 sequence numbers of the members whose computations are the maximum. Can be used to find positions of the maximum value in a sequence.

Parameters:

A

A sequence

x

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

Options:

@a

Return one sequence number or multiple ones s of the 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:

A sequence number or a 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 functions:

A.maxp()

A.pmin()