ICubeCreator.Table

Syntax

Table: ITable;

Description

The Table property determines a table to store data of created cube.

Comments

The table is not specified by default, it is created automatically. The table structure is formed according to the cube dimensions and factors collection. A repository table is created at the same location where the cube is stored. The actual table is created in the database specified in the Database property.

If the Table property is used, determine the ICubeCreatorDimension.Fields property to set up binding for each dimension, and determine the ICubeCreatorFact.Field property for each fact.

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

Example

Executing the example requires that the repository contains:

  1. Folder with the FOLDER_CUBES identifier.

  2. Table with the TABLE_CUBE identifier. The table must contain the VALUE number field that stores values, and the NAME string field that stores names.

  3. Table dictionary with the DIM_CUBE identifier. The dictionary must be based on the TABLE_CUBE table. Dictionary attribute identifiers must match source table fields identifiers. The dictionary must also contain index with the INDEX_NAME identifier based on the NAME attribute.

  4. Database with the DB_MSSQL identifier.

Add links to the Cubes, Db, Dimensions and Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    CCreator: ICubeCreator;
    Folder: IMetabaseObjectDescriptor;
    Facts: ICubeCreatorFacts;
    Dims: ICubeCreatorDimensions;
    Dim: IDimensionModel;
    CreatorDim: ICubeCreatorDimension;
    Fields: ICubeCreatorFields;
    CreatorFact: ICubeCreatorFact;
    CrInfo: IMetabaseObjectCreateInfo;
    TmpCube: IStandardCube;
Begin
    // Get current repository
    MB := MetabaseClass.Active;
    // Create an object that creates a cube
    CCreator := New CubeCreator.Create;
    // Specify the folder that is used for creating a cube
    Folder := MB.ItemById("FOLDER_CUBES");
    CCreator.DictionaryParent := Folder.Bind;
    // Specify the database that is used for creating a cube
    CCreator.Database := MB.ItemById("DB_MSSQL").Open(NullAs IDatabaseInstance;
    // Specify table, in which data is stored
    CCreator.Table := MB.ItemById("TABLE_CUBE").Bind As ITable;
    // Get collection of cube dimensions
    Dims := CCreator.Dimensions;
    // Get dictionary
    Dim := MB.ItemById("DIM_CUBE").Bind As IDimensionModel;
    // Add the dimension to cube that is based on obtained dictionary
    CreatorDim := Dims.Add(Dim);
    // Get the fields used for dimension binding
    Fields := CreatorDim.Fields;
    // Add a field with the NAME identifier
    Fields.Add("NAME");
    // Get index of the dictionary based on the NAME attribute
    CreatorDim.Index := Dim.Indexes.FindById("INDEX_NAME");
    // Specify that the NAME attribute is used
    CCreator.UseNameAttribute := True;
    // Add a fact dimension
    Facts := CCreator.Facts;
    // Add a fact
    CreatorFact := Facts.Add("VALUE");
    // Specify that facts in cube are local
    Facts.CreateExternalDimension := False;
    // Specify the table field used for facts value
    CreatorFact.Field := "VALUE";
    // Specify basic information about created cube     CrInfo := MB.CreateCreateInfo;
    // Specify the folder, in which a cube is created
    CrInfo.Parent := Folder;
    // Create a cube
    TmpCube := CCreator.CreateCube(CrInfo);
    // Save created cube to repository
    (TmpCube As IMetabaseObject).Save;
End Sub UserProc;

After executing the example an object for creating cubes is initialized. A dimension based on table dictionary is created. A dimension of cube facts is created from one fact. The corresponding table field is specified for it. The cube is created and saved in the FOLDER_CUBES folder.

See also:

ICubeCreator