Packaging unsupported features in n-Tier NVOs or DLLs

Packaging unsupported objects into n-Tier NVOs

Description

The objects shown in the following table are unsupported, but can be supported if they are packaged into n-Tier NVOs.

ADOResultSet

ArrayBounds

ClassDefinition

ClassDefinitionObject

ConnectionInfo

ConnectObject

CORBABadTypeContext

CORBABadInvorder

CORBABadOperation

CORBABadParam

CORBABadTypeCode

CORBACommFailure

CORBACurrent

CORBADataConversion

CORBAFreeMem

CORBAImpLimit

CORBAInitialize

CORBAInternal

CORBAIntFrePos

CORBAInvalidTransaction

CORBAInvFlag

CORBAInvIdentInvOBJRef

CORBAMarshal

CORBANoImplement

CORBANoMemory

CORBANoPermission

CORBANoResources

CORBANoResponse

CORBAOBJAdapter

CORBAObjectNoTexist

CORBAPersistStore

CORBASystemException

CORBATransactionRequired

CORBATransactionRolledback

CORBATranslent

CORBAUnion

CORBAUnknown

CORBAUserException

CPlusPlus

DivideByZeroError

ErrorLogging

Exception

JaguarORB

mailFileDescription

mailMessage

mailRecipient

mailSession

OLECustomControl

OLERuntimeError

OLEStorage

OLEStream

OLETxnObject

OMObject

OMStorage

OMStream

ORB

PBTocppObject

Pipeline

ProfileCall

ProfileClass

ProfileLine

ProfileRoutine

Profiling

RemoteObject

ResultSet

ResultSets

RuntimeError

ScriptDefinition

Service

SimpleTypeDefinition

SSLCallBack

SSLServiceProvider

SystemFunctions

Throwable

Timing

TraceActivityNode

TraceBeginEnd

TraceError

TraceESQL

TraceFile

TraceGarbageCollect

TraceLine

TraceObject

TraceRoutine

TraceTree

TraceTreeError

TraceTreeESQL

TraceTreeGarbageCollect

TraceTreeLine

TraceTreeNode

TraceTreeObject

TraceTreeRoutine

TraceTreeUser

TraceUser

TransactionServer

Transport

TypeDefinition

VariableCardinalityDefinition

VariableDefinition

Workaround

Encapsulate the relevant script into non-visual objects (NVOs) and deploy the NVOs to EAServer.

Note

You can also add almost any type of business logic into N-Tier NVOs. Many of the other unsupported features that are discussed in this Workarounds Guide can be supported in N-Tier NVOs, such as DataWindow.RetrieveRow function in a DataStore, etc.

Example

The following steps show how to work around the ArrayBounds object.

Step 1: Create NVO n_cst_rs.

Step 2: Declare variable instance in nvo(n_cst_rs).

resultset irs_resultset
   ADOresultset irs_ADOresultset

Step 3: Define the function Of_SetResultSet(ref oleobject aole).

// create ds_source
// generate a result set from an existing DataStore
ds_source.GenerateResultSet(irs_resultset)
  
// create a new ADOResultSet object and populate it
// from the generated result set
lrs_ADOresultset = CREATE ADOResultSet
lrs_ADOresultset.SetResultSet(irs_resultset)
// pass the data in the ADOResultSet object
// to an OLEObject you can use as an ADO Recordset
irs_ADOresultset.GetRecordSet(aole)

Step 4: Declare variable instance on the Client side.

OLEObject ioo_ADOrecordset
N_Cst_RS IN_Cst_RS

Step 5: Write script in the Client side objects.

ioo_ADOrecordset = CREATE OLEObject
IN_Cst_RS = CREATE N_CST_RS
IN_Cst_RS. Of_SetResultSet(ioo_ADOrecordset)
// call native ADO Recordset methods on the OLEObject
ioo_ADOrecordset.MoveFirst()

Step 6: Deploy the NVO to EAServer.

Placing unsupported functions into n-Tier NVOs

Description

Not all PowerScript functions are supported. For detailed information on all unsupported PowerScript functions, refer to Functions in Supported PB Features for Appeon Mobile (Mobile only) or in Supported PB Features for Appeon Web.

Workaround

If an unsupported PowerScript function meets the requirements for functions that can be packaged, encapsulate the function into a PowerBuilder non-visual user object (NVO).

Functions can be packaged into NVOs, provided that they do not:

  • use the PowerScript MessageBox function. (EAServer limitation)

  • use application global variables. (EAServer limitation)

  • use visual controls or objects. (EAServer limitation)

  • use Any or visual control/object data types as parameters for NVO functions and/or events. (EAServer limitation)

GetEnvironment, Randomize, and File functions are examples of functions that can be packaged.

For more information on how to use NVOs, refer to the section called “Moving unsupported features to Appeon Server as n-Tier NVOs” in Migration Guidelines for Appeon Web (Web only), or perform the steps shown in the following example.

Example

The PowerScript GetEnvironment function is used to populate the Environment object that holds information about the computing platform that the PowerBuilder application is running on. The GetEnvironment() and Environment object are unsupported by Appeon. To work around these unsupported features, consider moving them into Appeon Server.

Be aware that the GetEnvironment function, when executed in EAServer, returns the system information of the server machine.

The following code, written in the Clicked event of the cb_1 CommandButton in the PowerBuilder Client, gets the complete PowerBuilder version number.

Environment lenv_obj
Integer li_return
String ls_pbversion = "" // store PB version number
IF GetEnvironment (lenv_obj) = 1 THEN
 li_return = lenv_obj.PBMajorRevision
 ls_pbversion = ls_pbversion + String(li_return)
 li_return = lenv_obj.PBMinorRevision
 ls_pbversion = ls_pbversion + "." + String(li_return)
 li_return = lenv_obj.PBFixesRevision
 ls_pbversion = ls_pbversion + "." + String(li_return)
ELSE
 ls_pbversion = "-1"
END IF
MessageBox ("PB Version", ls_pbversion)

To enable the previous unsupported code to run in EAServer, perform the following steps:

Step 1: Create a PowerBuilder custom class user object in the PowerBuilder Client. Name the custom class user object nvo_environment.

Step 2: Add the user function of_GetPBVersion to nvo_environment. Set the function return value as a string, and add the following code to the function:

Environment lenv_obj
Integer li_return
String ls_pbversion = "" // store PB version number
IF GetEnvironment (lenv_obj) = 1 THEN
 li_return = lenv_obj.PBMajorRevision
 ls_pbversion = ls_pbversion + String(li_return)
 li_return = lenv_obj.PBMinorRevision
 ls_pbversion = ls_pbversion + "." + String(li_return)
 li_return = lenv_obj.PBFixesRevision
 ls_pbversion = ls_pbversion + "." + String(li_return)
ELSE
 ls_pbversion = "-1"
END IF
Return ls_pbversion

Step 3: Create an EAServer Component project in the PowerBuilder Client that contains information on deploying nvo_environment to EAServer, then deploy nvo_environment to EAServer within the PowerBuilder IDE.

Step 4: Create an EAServer Proxy project in the PowerBuilder Client that acts as the local representation of the deployed nvo_environment EAServer NVO component.

Step 5: When the PowerBuilder Client application starts, create a Connection object named myconnect, and connect to the EAServer that hosts the nvo_environment NVO component.

Step 6: In the Clicked event of the cb_1 CommandButton in the PowerBuilder Client, comment all the original code that gets the PowerBuilder version and add the following code to the event:

// Define local variables
long ll_rc
string ls_pbversion
nvo_environment lnvo_1
// Instantiate remote component
ll_rc = myconnect.CreateInstance(lnvo_1, "nvo_env/nvo_environment")
IF ll_rc <> 0 THEN
 MessageBox("Create instance failed", ll_rc)
END IF
// Call component method
ls_pbversion = lnvo_1.of_GetPBVersion()
MessageBox ("PB Version", ls_pbversion)

Step 7: Disconnect from EAServer when the Client application ends.