ICubeCreatorFact.Table

Syntax

Table: ITable;

Description

The Table property determines the repository table, to which the fact is required to bind.

Comments

The Table property is used if the fact values are stored in different tables.

After the Table property is set, call the InitDimensions method. This prepares dimensions to bind to the fields of the selected table. A dimensions collection can be obtained in the Dimensions property after calling the InitDimensions method and the ability to set up the binding to the table field using the Fields property of each of the dimensions. Binding to binary fields is not supported.

If the Table property is not specified, the access to dimensions and their setup are executed in the ICubeCreator.Dimensions property.

NOTE. If the ICubeCreatoFactr.Table property is set, the ICubeCreator.Table property must not be specified.

Example

Executing the example requires the following objects in the repository:

Sub UserProc;
Var
    MB: IMetabase;
    CCreator: ICubeCreator;
    Facts: ICubeCreatorFacts;
    Dims: ICubeCreatorDimensions;
    Dim: IDimensionModel;
    CreatorDim: ICubeCreatorDimension;
    CreatorFact1, CreatorFact2: ICubeCreatorFact;
    CrInfo: IMetabaseObjectCreateInfo;
    TmpCube: IStandardCube;
Begin
    MB := MetabaseClass.Active;
    //Cube creator
    CCreator := New CubeCreator.Create;
    //Cube dimensions collection
    Dims := CCreator.Dimensions;
    //Dimension that is based on the current dictionary
    Dim := MB.ItemById("CALENDAR").Bind As IDimensionModel;
    Dims.Add(Dim);
    //Cube facts
    Facts := CCreator.Facts;
    CreatorFact1 := Facts.Add("Fact1");
    CreatorFact1.Table := MB.ItemById("Table_1").Bind As ITable;
    CreatorFact1.Field := "F_FACT";
    CreatorFact1.AggregationType := CubeFactBindingAggregationType.Sum;

    CreatorFact2 := Facts.Add("Fact2");
    CreatorFact2.Table := MB.ItemById("Table_2").Bind As ITable;
    CreatorFact2.Field := "F_FACT";
    CreatorFact2.AggregationType := CubeFactBindingAggregationType.Sum;

    CreatorFact1.InitDimensions;
    CreatorFact2.InitDimensions;
    //Set up dimension by different data sources, to which facts are bound
    //Binding to table of the first fact
    CreatorDim := CreatorFact1.Dimensions.Item(0);
    CreatorDim.Fields.Add("F_CALENDAR");
    CreatorDim.Index := Dim.Blocks.Item("MONTHS").Indexes.PrimaryIndex;
    //Binding to the second fact table
    CreatorDim := CreatorFact2.Dimensions.Item(0);
    CreatorDim.Fields.Add("F_CALENDAR");
    CreatorDim.Index := Dim.Blocks.Item("YEARS").Indexes.PrimaryIndex;
    //Information about creating a repository object
    CrInfo := MB.CreateCreateInfo;
    CrInfo.Parent := MB.ItemById("F_CUBES");
    CrInfo.Permanent := True;
    //Cube creation
    TmpCube := CCreator.CreateCube(CrInfo);
    (TmpCube As IMetabaseObject).Save;
End Sub UserProc;

The cube creator is initialized on executing the example. Two facts are to be created in the facts collection. Each fact will be bound with a separate table, the aggregation will be set up. The dimension collection, based on the calendar dictionary, is created in collection. The binding to each table is set up for dimension. A cube is created in the specified folder.

See also:

ICubeCreatorFact