Consider the example of creating an automatic cube using the Fore and Fore.NET language. To create a cube, the following objects must be in the repository:
A database with the DB identifier.
A facts dictionary with the FACTS identifier.
A countries 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 examples, add links to the Cubes, Db, Dimensions and Metabase system assemblies. Write the corresponding Imports strings for the Fore.NET example.
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;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Db;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Metabase;
Sub CreateAutoCube(MB: IMetabase);
Var
CrInfo: IMetabaseObjectCreateInfo;
MObj: IMetabaseObject;
AutoCube: IAutoCube;
Dims: IAutoCubeDimensions;
Begin
CrInfo := MB.CreateCreateInfo();
CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_AUTOCUBE As Integer;
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;
See also: