AdditionalFields: ICubeCreatorAdditionalFields;
AdditionalFields: Prognoz.Platform.Interop.Cubes.ICubeCreatorAdditionalFields;
The AdditionalFields property returns the collection of additional fields that are not linked to cube dimensions or facts.
Additional fields are created in the output matrix of cube, but are not linked to cube structure dimensions or facts.
Executing the example requires the following objects in repository:
Database with the DB identifier.
Calendar dictionary with the CALENDAR identifier.
Folder with the F_CUBES identifier that stores the cubes.
Sub UserProc;
Var
MB: IMetabase;
CCreator: ICubeCreator;
Facts: ICubeCreatorFacts;
Dims: ICubeCreatorDimensions;
Dim: IDimensionModel;
CreatorDim1, CreatorDim2: ICubeCreatorDimension;
AdditionalDims: ICubeCreatorAdditionalFields;
CrInfo: IMetabaseObjectCreateInfo;
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("Dim1");
//Dimension that is based on the current dictionary
Dim := MB.ItemById("CALENDAR").Bind As IDimensionModel;
CreatorDim2 := Dims.Add(Dim);
//Index of the block, by which binding to 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");
CrInfo.Permanent := True;
//Additional fields
AdditionalDims := CCreator.AdditionalFields;
AdditionalDims.Add("TERRID", DbDataType.Integer);
//Cube creation
CCreator.CreateCube(CrInfo);
End Sub UserProc;
The cube creator is initialized on executing the example. A collection of dimensions is formed for cube creation, two facts are created in the collection of facts. A cube is created in the selected folder. On executing the CreateCube method the table is formed, in which the facts values are stored. Dimension and fact bindings are set up for this table. The TERRID field is also created in the table that will not have any binding in the cube.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dal;
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;
AdditionalDims: ICubeCreatorAdditionalFields;
CrInfo: IMetabaseObjectCreateInfo;
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("Dim1");
//Dimension that is based on the current dictionary
Dim := MB.ItemById["CALENDAR"].Bind() As IDimensionModel;
CreatorDim2 := Dims.Add(Dim);
//Index of the block, by which binding to 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"];
CrInfo.Permanent := True;
//Additional fields
AdditionalDims := CCreator.AdditionalFields;
AdditionalDims.Add("TERRID", DbDataType.ddtInteger);
//Cube creation
CCreator.CreateCube(CrInfo);
End Sub;
See also: