AnalyticInstance Class Methods

In this section, we discuss the AnalyticInstance methods. The methods are discussed in alphabetical order.

Syntax

CheckAsyncStatus(OperationID)

Description

Use the CheckAsyncStatus method to determine the current state of the asynchronous methods, as well as the Load method when executed asynchronously.

Parameters

Field or Control

Definition

OperationID

Specify the operation ID of the asynchronous operation. This operation ID is returned when one of the asynchronous operations is executed.

Returns

This method returns one of the following values:

Value

Description

Less than 0

The operation completed with errors.

0

The operation has not completed yet.

Greater than 0

The operation completed successfully.

Syntax

CheckStatus()

Description

Use the CheckStatus method to determine the current state of the analytic calculation engine.

Parameters

None.

Returns

This method returns one of the following values:

Value

Description

%AnalyticInstance_NotLoaded

The analytic instance has not been loaded into the application server.

%AnalyticInstance_Loading

The analytic instance is being loaded.

%AnalyticInstance_Idle

The analytic instance is idle, that is, not currently running.

%AnalyticInstance_Busy

The analytic instance is currently running.

%AnalyticInstance_ Inaccessible

The analytic instance is currently inaccessible.

%AnalyticInstance_ Terminating

The analytic instance is currently ending.

Syntax

Copy(NewID, ForceDelete&Record)

Description

Use the Copy method to copy all the data and metadata to a new analytic instance from the current analytic instance.

If the specified NewID exists, or any data for NewID exists, the data is not copied unless ForceDelete has been specified as true.

If a tree is attached to the existing analytic instance, all tree data is also copied to the new analytic instance.

In addition, the analytic instance and the tree information are not copied unless the record specified with the &Record parameter is populated with the existing analytic instance ID.

Parameters

Field or Control

Definition

NewID

Specify the new analytic instance ID as a string.

ForceDelete

If the specified NewID exists, and ForceDelete is specified as false, the copy is cancelled.

If the specified NewID exists, and ForceDelete is specified as true, the analytic instance specified by NewID is deleted, and a new analytic instance is created from the current ID.

&Record

Specify an already instantiated record object to pass in values to the Copy application package method that's defined with the specified analytic type definition.

Returns

None.

Example

&ai.Copy("MYTESTCOPY", True, &MyRecord);

Syntax

Delete(ForceUnload, &RecordRef)

Description

Use the Delete method to remove all the metadata related to the given analytic instance.

Every analytic type definition is defined with an application package that contains three methods: Create, Delete, and Copy. The values in &RecordRef are passed to the Delete method.

This method does not delete the analytic instance if the analytic instance is currently loaded. Specify ForceUnload as true to unload the analytic instance before deleting it.

Parameters

Field or Control

Definition

ForceUnload

Specify whether to force the deletion of the analytic instance. This parameter takes a Boolean value. If the analytic instance is currently loaded, specifying true for this parameter forces the analytic instance to be unloaded before it is deleted.

&RecordRef

Specify a record to pass in values to the application package Delete class that's associated with the analytic type definition.

Returns

None.

Example

&ai.Delete(TRUE, &Record);

Syntax

GetAnalyticModel(AnalyticModel.ModelName)

Description

Use the GetAnalyticModel method to return a reference to an AnalyticModel object.

Parameters

Field or Control

Definition

AnalyticModel.ModelName

Specify the name of the analytic model for which you want to return a reference. The model definition must already exist in Application Designer.

Returns

A reference to an AnalyticModel object or Null.

Syntax

Load(Sync, IdleTimeOut, Message.messagename)

Description

Use the Load method to load the AnalyticInstance object executing the method into the analytic server.

If this analytic instance is already loaded, this method fails.

When the analytic instance is loaded, if there are fields in the analytic type definition that haven't been selected but are mapped to a cube or dimension, an error message is logged to the analytic server log and the analytic instance load fails.

If there is a record in the analytic type definition that has none of its fields mapped to a cube or dimension, a warning message is logged to the analytic server log.

Parameters

Field or Control

Definition

Sync

Specify whether the analytic instance should be run synchronously or asynchronously. This parameter takes a Boolean value: true if it should be run synchronously, false otherwise.

See Running Synchronously.

IdleTimeOut

Specify, in minutes, the idle time out value. A value of 0 is an infinite time out. A value of -1 indicates that it should use the value specified in the default configuration for the analytic server.

Note: When loading an analytic grid, you should always specify a value of -1.

See Loading and Unloading Analytic Instances.

Message. MessageName

Specify an application message that should be sent if the analytic server crashes while the analytic instance is loaded.

Note: The message is sent when the analytic server process restarts itself after crashing.

Returns

A string. For asynchronous loads, this string is passed to the CheckAsyncStatus method.

This method returns one of the following values:

Value

Description

%AnalyticInstance_NotLoaded

The analytic instance has not been loaded into the analytic server.

%AnalyticInstance_Loading

The analytic instance is being loaded.

%AnalyticInstance_Idle

The analytic instance is idle, that is, not currently running.

%AnalyticInstance_Busy

The analytic instance is currently running.

%AnalyticInstance_ Inaccessible

The analytic instance is currently inaccessible.

%AnalyticInstance_ Terminating

The analytic instance is currently terminating.

Syntax

RunAsync()

Description

Use the RunAsync method to specify if the analytic instance executing the method should be run in an asynchronous manner.

This method is used only to define the transaction in the analytic type definition in optimization. PeopleSoft Analytic Calculation Engine programs uses the Load method for defining synchronous or asynchronous operation.

Parameters

None.

Returns

None.

Syntax

RunSync()

Description

Use the RunSync method to specify if the analytic instance executing the method should be run in a synchronous manner.

This method is used only to define the transaction in the analytic type definition in optimization. PeopleSoft Analytic Calculation Engine programs uses the Load method for defining synchronous or asynchronous operation.

Parameters

None.

Returns

None.

Syntax

Terminate()

Description

Use the Terminate method to force the termination of an analytic instance loaded in an analytic server.

This method should only be used from PeopleCode running in a Application Engine program to cause an analytic instance loaded in an analytic server to be terminated.

Attempting to terminate an analytic instance that is not loaded or is loaded in a Application Engine process results in a PeopleCode exception.

Although the Terminate method returns instantly, it may take up to a minute before the analytic instance is actually terminated.

Parameters

None.

Returns

None.

Syntax

Unload()

Description

Use the Unload method to unload the analytic instance executing the method from the analytic server. After unloading the analytic instance, the analytic server process is restarted.

Parameters

None.

Returns

None.

Example

&ai.UnLoad();