ICubeCreator.CreateCube

Syntax

CreateCube(CreateInfo: IMetabaseObjectCreateInfo): IStandardCube;

Parameters

CreateInfo. The description, according to which a cube is created.

Description

The CreateCube method creates and sets up a standard cube.

Comments

The following operations are executed on executing the method:

The method results in a standard cube opened for edit.

Example

Executing the example requires the following objects in the repository:

Sub UserProc;
Var
    MB: IMetabase;
    Rds: IRdsDatabaseInstance;
    CCreator: ICubeCreator;
    Facts: ICubeCreatorFacts;
    Dims: ICubeCreatorDimensions;
    Dim: IDimensionModel;
    CreatorDim1, CreatorDim2: ICubeCreatorDimension;
    CrInfo: IMetabaseObjectCreateInfo;
    TmpCube: IStandardCube;
Begin
    MB := MetabaseClass.Active;
    Rds := MB.ItemById("RDS").Open(NullAs IRdsDatabaseInstance;
    //Cube creator
    CCreator := New CubeCreator.Create;
    CCreator.RdsDatabase := Rds;
    CCreator.Database := Rds.DatabaseInstance;
    //Cube dimensions collection
    Dims := CCreator.Dimensions;
    //New dimension, for which a personal dictionary is created
    CreatorDim1 := Dims.AddNew("Dim1");
    //Dimension that is based on the current dictionary
    Dim := MB.ItemById("CALENDAR").Bind As IDimensionModel;
    CreatorDim2 := Dims.Add(Dim);
    //Block index, by which the cube binding to the table fields is executed
    CreatorDim2.Index := Dim.Blocks.Item("MONTHS").Indexes.PrimaryIndex;
    //Cube facts
    Facts := CCreator.Facts;
    Facts.Add("Fact1");
    Facts.Add("Fact2");
    //Information about creating a repository object
    CrInfo := MB.CreateCreateInfo;
    CrInfo.Parent := MB.ItemById("F_CUBES");
    //Cube creation
    TmpCube := CCreator.CreateCube(CrInfo);
    (TmpCube As IMetabaseObject).Save;
End Sub UserProc;

The cube creator is initialized on executing the example. The dimensions collection is formed for cube creation: the first dimension is new (a new table MDM dictionary is created for dimension in MDM repository); the second dimension is created on the base of calendar dictionary. Two facts are to be created in the facts collection. A cube is created in the selected folder. On executing the CreateCube method the table is formed, in which the facts values are stored. Bindings of dimensions and facts are set up for this table.

See also:

ICubeCreator