This chapter provides an overview of the analytic type classes, and discuses:
The analytic type classes
Error handling
Data types of the analytic type objects
Scope of analytic type objects
How to import the analytic type classes
How to create an analytic type class object
Analytic type reference
Understanding the Analytic Calculation Engine Classes
PeopleSoft Analytic Calculation Engine comprises a calculation engine plus several PeopleTools features which enable application developers to define both the calculation rules and the display of calculated data within PeopleSoft applications for the purposes of multi-dimensional reporting, data editing, and analysis.
More specifically, developers create analytic models in order to define the rules which are used to calculate data. Developers also create PeopleSoft Pure Internet Architecture pages with analytic grids in order to display the data within PeopleSoft applications. End users view, analyze and make changes to this data. When end users save their changes, PeopleSoft Analytic Calculation Engine recalculates the data and saves the calculated data to the database.
PeopleCode enables developers to manipulate analytic calculation data as follows:
Use the Analytic Calculation Engine classes to either retrieve or specify data in an instance of an analytic model loaded into the system, and also to calculate (or recalculate) cube values.
Use the Analytic Calculation Engine metadata classes to manipulate an analytic model definition. For example, you can add cubes to a cube collection or rename an existing user function for a model.
Use the analytic grid classes to manipulate the display of analytic calculation data on a page.
Use the analytic type metadata classes to manipulate an analytic type definition. For example, you can specify a new analytic model for an analytic type definition.
See Also
Analytic Calculation Engine Metadata Classes
Enterprise PeopleTools 8.49 PeopleBook: PeopleSoft Analytic Calculation Engine
Using the Analytic Type ClassesYou can create analytic type definitions using PeopleSoft Application Designer. PeopleSoft provides the analytic type classes for accessing these definitions at runtime.
You can also create an analytic type definition in PeopleCode, using the Create method, then saving it to the database using the Save method. After you save the definition, you can access it using PeopleSoft Application Designer.
You only need to create an instance of the analytic type. All other objects are instantiated from the analytic type object.
Once the AnalyticTypeDefn object is created, you can then execute either the Get or Create methods to “instantiate” the analytic type object.
Error HandlingAll the analytic type classes throw PeopleCode exceptions for any fatal error that occurs in the execution of the operation. PeopleSoft recommends enclosing your analytic model programs in try-catch statements. This way, if your program catches the exception, the message set and message number that are associated with the exception object indicate the error.
See Also
Data Types of the Analytic Type ObjectsEvery PeopleSoft analytic type object is declared as its own data type, that is, AnalyticTypeDefn objects are declared as type AnalyticTypeDefn, AnalyticTypeModelDefn objects are declared as type AnalyticTypeModelDefn, and so on.
The following are the data types for the PeopleSoft analytic type classes:
AnalyticTypeDefn
AnalyticTypeModelDefn
AnalyticTypeRecordDefn
Scope of Analytic Type ObjectsThe analytic type objects can only be instantiated from PeopleCode.
These objects can be used anywhere you have PeopleCode, that is, in a PeopleSoft Application Engine program, an application class, record field PeopleCode, and so on.
Analytic type objects can be of scope Local, Component or Global.
How to Import the Analytic Type ClassesThe analytic type classes are not built-in classes, like Rowset, Field, Record, and so on. They are application classes. Before you can use these classes in your PeopleCode program, you must import them to your program.
An import statement names either all the classes in a package or one particular application class. For importing the analytic type classes, PeopleSoft recommends that you import all the classes in the application package.
The application package PT_ANALYTICTYPEDEFN contains the following subclasses:
AnalyticTypeDefn
AnalyticTypeModelDefn
AnalyticTypeRecordDefn
The import statement you should use should be as follows:
import PT_ANALYTICTYPEDEFN:*;
Using the asterisks after the package name makes all the application classes directly contained in the named package available.
See Also
How to Create an Analytic Type Class ObjectAfter you've imported the analytic type classes, you need to instantiate an instance of the AnalyticTypeDefn class, using the constructor for that class and the Create function. After you create the object, you must populate it using either the Get or Create method.
The following example creates an AnalyticTypeDefn object from the QE_ACE_ALLFUNCTION analytic type definition.
Local PT_ANALYTICTYPEDEFN:AnalyticTypeDefn &AnalyticType; &AnalyticType = create PT_ ANALYTICTYPEDEFN:AnalyticTypeDefn("QE_ACE_ALLFUNCTION");
See Also
Analytic Calculation Engine Metadata Classes Constructor
Analytic Type Classes ConstructorYou must use the constructor for the AnalyticTypeDefn class to instantiate an instance of that class. All other objects are instantiated from this class.

AnalyticTypeDefnSyntax
AnalyticTypeDefn(TypeName)
Description
Use the AnalyticTypeDefn constructor to create an AnalyticTypeDefn.
Once the AnalyticTypeDefn object is created, you can then execute either the Get or Create methods to instantiate the model.
Note. The Delete and Rename methods can only be executed before a model is instantiated.
Parameters
|
TypeName |
Specify the name of an analytic type definition. |
Returns
An AnalyticTypeDefn object.
Example
&Model = create AnalyticTypeDefn("QE_ACE_ALLFUNCTION");
See Also
AnalyticTypeDefn Class MethodsThis section describes the analytic type definition class methods. The methods are discussed in alphabetical order.

AddModelSyntax
AddModel(ModelName, ModelType)
Description
Use the AddModel method to add either an analytic model or optimization model to the analytic type definition. If the model doesn't exist, this method fails.
Parameters
|
ModelName |
Specify the name of an existing model. |
|
ModelType |
Specify the model type. Values are: |
|
Value |
Description |
|
%ModelType_ACE |
The model is an Analytic Calculation Engine. |
|
%ModelType_OPT |
The model is an optimization. |
Returns
The new AnalyticTypeModelDefn object.
See Also
AnalyticTypeModelDefn Class Properties

AddRecordSyntax
AddRecord(RecordName)
Description
Use the AddRecord method to add a record to the analytic type definition. If the record definition doesn't exist in PeopleSoft Application Designer, or if the record already exists in this analytic type definition, this method fails.
Parameters
|
RecordName |
Specify the name of the record that you want to add. |
Returns
An AnalyticTypeRecordDefn object that represents the record.
See Also
AnalyticTypeRecordDefn Class Methods

CreateSyntax
Create()
Description
Use the Create method to create, and instantiate, a new analytic type. If the analytic type already exists, an exception is thrown.
Parameters
None.
Returns
None.
See Also

CopyToSyntax
CopyTo(NewAnalyticTypeName)
Description
Use the CopyTo method to copy the current AnalyticTypeDefn object to the AnalyticTypeDefn object with the specified name. This method fails if the analytic type specified with NewAnalyticTypeName already exists.
Parameters
|
NewAnalyticTypeName |
Specify the name of the new analytic type definition that you want to create. |
Returns
The new AnalyticTypeDefn object.
See Also

DeleteSyntax
Delete()
Description
Use the Delete method to delete the analytic type definition. You must use this method immediately after you create the AnalyticType object, before you instantiate it, that is, before you use either the Get or Create method.
Note. This method executes immediately, and deletes the definition from PeopleSoft Application Designer.
Parameters
None.
Returns
None.
See Also

DeleteModelSyntax
DeleteModel(ModelName)
Description
Use the DeleteModel method to delete the specified model from the analytic type definition.
Note. The model is not deleted from the analytic type definition until you use the Save method.
Parameters
|
ModelName |
Specify the name of a model that exists in the analytic type definition. |
Returns
None.
See Also
AnalyticTypeModelDefn Class Properties

DeleteRecordSyntax
DeleteRecord(RecordName)
Description
Use the DeleteRecord method to delete a record from the analytic type definition.
Note. The record deleted from the analytic type definition until you use the Save method.
Parameters
|
RecordName |
Specify the name of the record that you want to remove from the analytic type definition. |
Returns
None.
See Also
AnalyticTypeRecordDefn Class Methods

GetSyntax
Get()
Description
Use the Get method to instantiate an existing analytic type definition as an AnalyticTypeDefn object. If the analytic type doesn't exist, this method throws an exception.
Parameters
None.
Returns
None.
See Also

GetModelSyntax
GetModel(ModelName)
Description
Use the GetModel method to return a reference to an AnalyticTypeModelDefn object.
This method fails if the model specified by ModelName doesn't exist.
Parameters
|
ModelName |
Specify the name of the analytic type model definition that you want to access. |
Returns
An AnalyticTypeModelDefn object.
See Also
AnalyticTypeModelDefn Class Properties.

GetModelNamesSyntax
GetModelNames()
Description
Use the GetModelNames method to return an array of string containing all the model names in this analytic type definition.
Parameters
None.
Returns
An array of string.
See Also
AnalyticTypeModelDefn Class Properties

GetRecordSyntax
GetRecord(RecordName)
Description
Use the GetRecord method to return a reference to an AnalyticTypeRecordDefn object.
This method fails if the record specified by RecordName doesn't exist.
Parameters
|
RecordName |
Specify the name of the record that you want to access. |
Returns
An AnalyticTypeRecordDefn object.
See Also
AnalyticTypeRecordDefn Class Methods.

GetRecordNamesSyntax
GetRecordNames()
Description
Use the GetRecordNames method to return an array of string containing the names of all the records associated with the analytic type definition.
Parameters
None.
Returns
An array of string.
See Also
AnalyticTypeRecordDefn Class Methods

RenameSyntax
Rename(NewAnalyticTypeName)
Description
Use the Rename method to rename an existing analytic type definition to a new name. You must use this method immediately after you create the AnalyticType object, before you instantiate it, that is, before you use either the Get or Create method. The new name is not saved to the database until you use the Save method.
Parameters
|
NewAnalyticTypeName |
Specify the new name for the analytic type definition. |
Returns
None.
See Also

SaveSyntax
Save()
Description
Use the Save method to save any changes that were made to the AnalyticTypeDefn object to the database.
Parameters
None.
Returns
None.
AnalyticTypeDefn Class PropertiesIn this section we discuss the AnalyticTypeDefn class properties. The properties are described in alphabetic order.

AppClassPathDescription
Use this property to specify the full name of the application package that contains the Create, Copy and Delete methods used with this analytic type definition.
This property is read-write.

CommentsDescription
Use this property to specify comments for the analytic type.
This property is read-write.

DescriptionDescription
Use this property to specify a description for the analytic type.
This property is read-write.

NameDescription
This property specifies the name of the AnalyticTypeDefn.
This property is read-only.

OwnerIDDescription
This property specifies the owner ID for this AnalyticTypeDefn.
This property is read-write.
AnalyticTypeModelDefn Class PropertiesIn this section we discuss the AnalyticTypeModelDefn class properties. The properties are described in alphabetic order.

NameDescription
This property specifies the name of the analytic type model.
This property is read-only.

TypeDescription
This property specifies the type of the analytic type model. Values are:
|
Value |
Description |
|
%ModelType_ACE |
The model is an Analytic Calculation Engine. |
|
%ModelType_OPT |
The model is an optimization. |
This property is read-only.
AnalyticTypeRecordDefn Class MethodsIn this section we describe the AnalyticTypeRecordDefn class methods. The methods are discussed in alphabetic order.

GetSelectedFieldSyntax
GetSelectedField()
Description
Use the GetSelectedField to return an array of string containing the names of the fields that are selected for this record.
Parameters
None.
Returns
An array of string.
See Also

SetSelectedFieldSyntax
SetSelectedFields(FieldName)
Description
Use the SetSelectedField method to specify the name of the field that is selected for this record.
Parameters
|
FieldName |
Specify the name of the field that you want to select. |
Returns
None.
See Also

UnsetSelectedFieldSyntax
UnsetSelectedField(FieldName)
Description
Use the UnsetSelectedField method to unselect the selected field.
This method throws an exception if the field specified by FieldName isn't selected.
Parameters
|
FieldName |
Specify the name of the field that you want to deselect. |
Returns
None.
AnalyticTypeRecordDefn Class PropertiesIn this section we discuss the AnalyticTypeRecordDefn class properties. The properties are described in alphabetic order.
All of the properties listed here can also be set for the analytic type definition using PeopleSoft Application Designer.
See Also
Understanding Analytic Model Properties

CallbackDescription
Use this property to specify whether this record has a callback. This property takes a boolean value, true if the record has a callback, false otherwise.
This property is read-write.

DescriptionDescription
Use this property to specify a description for the record.
This property is read-write.

NameDescription
This property specifies the name of the record.
This property is read-only.

ReadableDescription
Use this property to specify whether this record is readable. This property takes a boolean value, true if the record is readable, false otherwise.
This record is read-write.

ReadOnceDescription
Use this property to specify whether this record is specified as read once. This property takes a boolean value, true if the record is only read once, false otherwise.
This property is read-write.

ScenarioManagedDescription
Use this property to specify if the record is specified as scenario managed. This property takes a boolean value, true if the record is scenario managed, false otherwise.
This property is read-write.

SyncOrderDescription
This property specifies the synchronization order for the record. It returns an integer value.
This property is read-write.

WriteableDescription
Use this property to specify if a record is specified as writeable. This property takes a boolean value, true if the record is writeable, false otherwise.
This property is read-write.
AnalyticType Classes ExampleThe following is a typical example of using the AnalyticType classes.
import PT_ANALYTICTYPEDEFN:*; Local PT_ANALYTICTYPEDEFN:AnalyticTypeDefn &AnalyticType; Local PT_ANALYTICTYPEDEFN:AnalyticTypeRecordDefn &AnalyticTypeRecordDefn; &AnalyticType = create PT_ ANALYTICTYPEDEFN:AnalyticTypeDefn("BB_TEST"); &AnalyticType.Create(); &AnalyticType.AddModel("QE_BAM_GENX", %ModelType_ACE); &AnalyticTypeRecordDefn = &AnalyticType.AddRecordl("QE_BAM_CCSMOKE"); &AnalyticTypeRecordDefn = &AnalyticType.AddRecordl("QE_BAM_FACTTBL"); &AnalyticType.Save();