EditCube(Cube: IStandardCube);
EditCube(Cube: Prognoz.Platform.Interop.Cubes.IStandardCube);
Cube. The cube, which structure must be edited.
The EditCube method edits the structure of the specified cube according to the determined settings of the current object.
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.
Executing the example requires the following objects in the repository:
Standard cube with the STD_CUBE identifier, which structure is edited.
Database with the DB identifier. This database will store cube data.
Calendar dictionary with the CALENDAR identifier.
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(Null) As 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.
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(Null) As 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: