Creating an Automatic Cube

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:

  1. A database with the DB identifier

  2. A fact dictionary with the FACTS identifier.

  3. A country dictionary with the COUNTRY identifier.

  4. 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:

To execute the examples, add links to the Cubes, Db, Dimensions, and Metabase system assemblies.

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;

See also:

Examples