Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Where to declare variables – PB Docs 2019 – PowerBuilder Library

Where to declare variables – PB Docs 2019

Where to declare variables

Scope

You determine the scope of a PowerScript variable by selecting
where you declare it. Instance variables have additional access keywords
that restrict specific scripts from accessing the variable.

The following table shows the four scopes of variables.

Scope

Description

Global

Accessible anywhere in the application. It is
independent of any object definition.

Instance

Belongs to an object and is associated with an
instance of that object (you can think of it as a property of
the object). Instance variables have access keywords that
determine whether scripts of other objects can access them. They
can belong to the application object, a window, a user object,
or a menu.

Shared

Belongs to an object definition and exists across
all instances of the object. Shared variables retain their value
when an object is closed and opened again.

Shared
variables are always private. They are accessible only in
scripts for the object and for controls associated with the
object. They can belong to the application object, a window, a
user object, or a menu.

Local

A temporary variable that is accessible only in the
script in which you define it. When the script has finished
executing, the variable constant ceases to exist.

Global, instance, and shared
declarations

Global, instance, and shared variables can be defined in the
Script view of the Application, Window, User Object, or Menu painters.
Global variables can also be defined in the Function painter:

  1. Select Declare from the first drop-down list in the Script
    view.

  2. Select the type of variable you want to declare in the second
    drop-down list of the Script view.

  3. Type the declaration in the scripting area of the Script
    view.

Local declarations

You declare local variables for an object or control in the script
for that object or control.

Declaring SQL cursors

You can also declare SQL cursors that are global, shared,
instance, or local. Open a specific script or select a variable
declaration scope in the Script view and type the DECLARE SQL statement
or select Paste SQL from the PainterBar or pop-up menu.


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