ICubeCreatorFact.Table

Fore Syntax

Table: ITable;

Fore.NET Syntax

Table: Prognoz.Platform.Interop.Db.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.

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;
    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";
    CreatorFact2 := Facts.Add("Fact2");
    CreatorFact2.Table := MB.ItemById("Table_2").Bind As ITable;
    CreatorFact2.Field := "F_FACT";
    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. The dimensions collection is formed to create a cube. A dimension, based on the calendar dictionary, is created in the collection. Two facts are to be created in the facts collection. Each fact is bound to separate the table. The binding to each table is set up for dimension. A cube is created in the specified folder.

Fore.NET Example

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.Db;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Metabase;

Public Shared Sub Main11(Params: StartParams);
Var
    MB: IMetabase;
    CCreator: ICubeCreator;
    Facts: ICubeCreatorFacts;
    Dims: ICubeCreatorDimensions;
    Dim: IDimensionModel;
    CreatorDim: ICubeCreatorDimension;
    CreatorFact1, CreatorFact2: ICubeCreatorFact;
    CrInfo: IMetabaseObjectCreateInfo;
    TmpCube: IStandardCube;
Begin
    MB := Params.Metabase;
    //Cube creator
    CCreator := New CubeCreatorClass();
    //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";
    CreatorFact2 := Facts.Add("Fact2");
    CreatorFact2.Table := MB.ItemById["Table_2"].Bind() As ITable;
    CreatorFact2.Field := "F_FACT";
    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;

See also:

ICubeCreatorFact