Using the Analytic Calculation Engine Metadata Classes

You can create analytic model definitions using Application Designer. PeopleSoft provides the Analytic Calculation Engine Metadata classes for accessing these definitions at runtime.

You can also create an analytic model 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 Application Designer.

All of the primary objects (dimensions, cube collections, cubes, and so on) are instantiated from an analytic model object, so you only need to create an instance of the analytic model. You can also build a rule as an object instead of as a string.

If you insert or delete an object from a group of objects, any existing object references are no longer valid. For example, if you use the DeleteCube method, any existing references to cube objects are no longer valid. You need to create any object references after using any insert or delete method.

The RuleExpressions sub-package contains several classes. Each of these classes represents the different parts of the analytic calculation engine rule grammar. These objects are created using the Create built-in function and the constructor for that class, then added to the RuleDefn object with the AddRuleExpression method.

The following example creates a cube that uses the Analytic Calculation Engine built-in function AT.

Function AT_Cube
   /** AT Cube Rule **/
   &Expected = "AT(GENERAL2, [GENERAL2:4], LOOKUPVALUES)";
   &CubeName = "AT";
   
   &FunCall = create PT_ANALYTICMODELDEFN:RuleExpressions:FunctionCall(&Constants.FuncCall_Type_Builtin, &Constants.FuncCall_Builtin_AT);
   
   &Constant = create PT_ANALYTICMODELDEFN:RuleExpressions:Constant(&Constants.Constant_Type_Literal, "GENERAL2");
   &FunCall.AddArgument(&Constant);
   
   &MemberRefArgument = create PT_ANALYTICMODELDEFN:RuleExpressions:MemberReference("GENERAL2", "4");
   &FunCall.AddArgument(&MemberRefArgument);
   
   &CubeArgument = create PT_ANALYTICMODELDEFN:RuleExpressions:Cube("LOOKUPVALUES");
   &FunCall.AddArgument(&CubeArgument);
   
   &RuleDefn = create PT_ANALYTICMODELDEFN:RuleDefn("");
   &CubeDefn = &Model.GetCube(&CubeName);
   &RuleDefn.AddRuleExpression(&FunCall);
   &RuleDefn.GenerateRule();
   &CubeDefn.SetRule(&RuleDefn);
   If ( Not (Exact(&RuleDefn.RuleString, &Expected))) Then
      &Model.Save();
      Error ("Rule Experession API Failed [Cube " | &CubeName | " Rule]");
   End-If;
End-Function;