UpperBound – PB Docs 2017

UpperBound

PowerScript function

Description

Obtains the upper bound of a dimension of an array.

Syntax

Argument

Description

array

The name of the array for which you want the upper bound
of a dimension

n (optional)

The number of the dimension for which you want the upper
bound. The default is 1

Return value

Long.

Returns the upper bound of dimension n of array. If n is greater
than the number of dimensions of the array, UpperBound returns -1. If any
argument’s value is null, UpperBound returns null.

Usage

For variable-size arrays, memory is allocated for the array when you
assign values to it. UpperBound returns the largest value that has been
defined for the array in the current script. Before you assign values, the
lower bound is 1 and the upper bound is 0. For fixed arrays, whose size is
specified when it is declared, UpperBound always returns the declared
size.

Examples

The following statements illustrate the values UpperBound reports
for fixed-size arrays and for variable-size arrays before and after memory
has been allocated:

This example determines the position of a menu bar item called File,
and if the item has a cascading menu with an item called Update, disables
the Update item. The code could be a script for a control in a
window.

The code includes a rather complicated construct:
Parent.Menuid.Item. Its components are:

  • Parent — The parent window of the control that is running the
    script.

  • Menuid — A property of a window whose value identifies the menu
    associated with the window.

  • Item — A property of a menu that is an array of items in that
    menu. If Item is itself a drop-down or cascading menu, it has its own
    item array, which can be a fourth qualifier.

The script is:

See also

LowerBound


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x