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

SharedObjectGet – PB Docs 126 – PowerBuilder Library

SharedObjectGet – PB Docs 126

SharedObjectGet PowerScript function

Description

Gets a reference to a shared object instance.

Syntax

Argument

Description

instancename

The name of a shared object instance
to which you want to obtain references. The name you specify must
match the name given to the object instance when it was first registered
with the SharedObjectRegister function.

objectinstance

An object variable of type PowerObject
in which you want to store an instance of a shared object.

Return Values

ErrorReturn. Returns one of the following values:

  • Success! – The function
    succeeded

  • SharedObjectCreateInstanceError! – The
    local reference to the shared object could not be created

  • SharedObjectNotExistsError! – The instance
    name has not been registered

Usage

SharedObjectGet retrieves a reference to
an object that was created with SharedObjectRegister.

You can use a shared object on a PowerBuilder client to simulate
an asynchronous call to EAServer.
The main thread on the client makes an asynchronous call to a function
on the shared object, passing it a callback object that is notified
when processing has finished on the server. The method on the shared
object makes a synchronous call to the EAServer component method
that performs processing. Since the shared object is running in
a separate thread on the client, the main thread on the client can
proceed with other work while the process runs on the server.

Examples

This example shows how you might use a shared object
to make an asynchronous request against an EAServer component
method and return data back to a client application window. The
client has a Retrieve button on a window, a SetDW function,
a shared object, and a callback handler. The component deployed
to EAServer retrieves employee
information from a database.

The Retrieve button on the window creates a shared object
that communicates with EAServer as
well as an instance of a callback handler:

The SetDW function applies the contents
of the DataWindow blob returned from the EAServer component
to a DataWindow control in the window:

The Constructor event of the shared object uses a custom Connection
object called n_jagclnt_connect to
connect to the server. Then it creates an instance of the EAServer component:

The shared object has a single function called RetrieveData that
makes a synchronous call to the RetrieveData function
on the EAServer component.

When the function completes processing, it calls the Notify function asynchronously
on the callback object, posting it to the DataWindow blob returned
from the server component:

When the EAServer component
has finished processing, the shared object notifies a user object
called uo_callback, which in turns
notifies the w_employee window. The uo_callback object
has two functions, Notify and PassObject.The Notify function
calls a function called SetDW on the w_employee window, passing
it the DataWindow blob returned from the server component:

The callback handler’s PassObject function
caches a reference to the w_employee window
in the iw_employee instance variable.
The function takes the argument aw_employee,
which is of type w_employee, and returns
a long value:

The EAServer component
is a PowerBuilder user object called uo_employee. The uo_employee object
has a function called RetrieveData that uses
a DataStore to retrieve employee rows from the database:

See Also


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