Consider the example of creating an automatic cube with the use of the Fore language. To create a cube, the following objects must be in the repository:
A database with the DB identifier
A fact dictionary with the FACTS identifier.
A country dictionary with the COUNTRY identifier.
A calendar dictionary with the CALENDAR identifier.
The following example creates a new object that is Automatic Cube in the repository root and sets up its parameters:
The database is specified.
The list of its dimensions is set.
To execute the examples, add links to the Cubes, Db, Dimensions, and Metabase system assemblies.
Sub CreateAutoCube;
Var
MB: IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
MObj: IMetabaseObject;
AutoCube: IAutoCube;
Dims: IAutoCubeDimensions;
Begin
MB := MetabaseClass.Active;
CrInfo := MB.CreateCreateInfo;
CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_AUTOCUBE;
CrInfo.Id := "New_Auto_Cube";
CrInfo.Name := "New automatic cube";
CrInfo.Parent := MB.Root;
MObj := MB.CreateObject(CrInfo).Edit;
AutoCube := MObj As IAutoCube;
//Specify the database, which stores cube data
AutoCube.Database := MB.ItemById("DB").Bind As IDatabase;
//Set list of cube dimensions
Dims := AutoCube.Dimensions;
Dims.Add(MB.ItemById("FACTS").Bind As IDimensionModel);
Dims.Add(MB.ItemById("COUNTRY").Bind As IDimensionModel);
Dims.Add(MB.ItemById("CALENDAR").Bind As IDimensionModel);
MObj.Save;
End Sub CreateAutoCube;
See also: