segp()

Read(105) Label: sequence, interval number,

Description:

Return the member in a sequence corresponding to a certain interval number.

Syntax:

A.segp(x,y)

Note:

The expression finds the interval number where parameter y falls in ordered sequence A and returns the member matching the interval number. By default the intervals between members of the sequence are left-closed and right-open. Expression parameter x is calculated over each member of sequence A.

If parameter y isn’t a member of sequence A, return null if members of the sequence are ordered ascendingly and if y is less than the smallest member, or if members of the sequence are ordered descendingly and if y is greater than the largest member. The function will return the largest member value if members of the sequence are ordered ascendingly and if parameter y is greater than and equal to the largest member value; or return the smallest member value if members of the sequence are ordered descendingly and if parameter y is less than and equal to the smallest member value.

Parameters:

A

A sequence

x

A field expression or a legal expression made up of field names, in which “~” can be used to reference the current record and which can be absent

y

An expression

Options:

@r

Use left-open and right-closed intervals

Return value:

A member of the specified sequence

Example:

 

A

 

1

[2,22,122,222,2222]

 

2

=A1.segp(1)

Return null

3

=A1.segp(100)

22; the intervals between members of the sequence are [2,22), [22,122),

[122,222), [222,2222) and [2222,∞); 100 falls in interval [22,122), the second interval, so the function returns the second member

4

=A1.segp(3000)

2222

5

=A1.segp(~+~,200)

22

6

=A1.segp(~+~,244)

122

7

=A1.segp@r(~+~,244)

22; left-open and right-closed intervals with@r option