ICubeCreator.EditCube

Fore Syntax

EditCube(Cube: IStandardCube);

Fore.NET Syntax

EditCube(Cube: Prognoz.Platform.Interop.Cubes.IStandardCube);

Parameters

Cube. The cube, which structure must be edited.

Description

The EditCube method edits the structure of the specified cube according to the determined settings of the current object.

Comments

On executing the example the specified cube structure is edited according to the set of dimensions and facts specified in the ICubeCreator.Dimensions and ICubeCreator.Facts properties, respectively. If local dimension of facts is used in the cube, it is reset. A new MDM table dictionary is created for facts dimension.

IMPORTANT. On editing the structure of the current cube the structure of the table, which stores cube data, is also edited. All old data is deleted.

Fore Example

Executing the example requires the following objects in the repository:

Sub UserProc;
Var
    MB: IMetabase;
    CCreator: ICubeCreator;
    Facts: ICubeCreatorFacts;
    Dims: ICubeCreatorDimensions;
    Dim: IDimensionModel;
    CreatorDim1, CreatorDim2: ICubeCreatorDimension;
Begin
    MB := MetabaseClass.Active;
    //Cube creator
    CCreator := New CubeCreator.Create;
    CCreator.Database := MB.ItemById("DB").Open(NullAs IDatabaseInstance;
    //Cube dimensions collection
    Dims := CCreator.Dimensions;
    //New dimension, for which a personal dictionary is created
    CreatorDim1 := Dims.AddNew("Country");
    //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("YEARS").Indexes.PrimaryIndex;
    //Cube facts
    Facts := CCreator.Facts;
    Facts.Add("Value");
    //Edit cube
    CCreator.EditCube(MB.ItemById("STD_CUBE").Bind As IStandardCube);
End Sub UserProc;

On executing the example the specified cube structure is edited. The structure will contain two dimensions, a separate dictionary is created for facts. All previous cube data is deleted.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example. Use Fore.NET analogs instead of Fore components.

Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Db;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Metabase;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    CCreator: ICubeCreator = New CubeCreator();
    Facts: ICubeCreatorFacts;
    Dims: ICubeCreatorDimensions;
    Dim: IDimensionModel;
    CreatorDim1, CreatorDim2: ICubeCreatorDimension;
Begin
    MB := Params.Metabase;
    //Cube creator
    CCreator.Database := MB.ItemById["DB"].Open(NullAs IDatabaseInstance;
    //Cube dimensions collection
    Dims := CCreator.Dimensions;
    //New dimension, for which a personal dictionary is created
    CreatorDim1 := Dims.AddNew("Country");
    //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["YEARS"].Indexes.PrimaryIndex;
    //Cube facts
    Facts := CCreator.Facts;
    Facts.Add("Value");
    //Edit cube
    CCreator.EditCube(MB.ItemById["STD_CUBE"].Bind() As IStandardCube);
End Sub;

See also:

ICubeCreator