IMDCalculationFormulasTable.Attach

Syntax

Attach(Table: ITable);

Parameters

Table. The table that must be connected as a formula table for multidimensional calculation on database server.

Description

The Attach method connects the table passed by the input parameter as a formula table for multidimensional calculation on database server.

Example

Executing the example requires that the repository contains a database with the MDBD identifier and two standard cubes CUBE_INPUT and CUBE_OUTPUT. These cubes are based on the tables stored in this database.

Sub UserProc;
Var
    Mb: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    MDCalc: IMDCalculation;
    Cube: ICubeModel;
    FormulasTable: IMDCalculationFormulasTable;
    TableForFormulas: ITable;
Begin
    Mb := MetabaseClass.Active;
    CrInfo := Mb.CreateCreateInfo;
    CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_MDCALCULATION;
    CrInfo.Id := "MDCALC_1";
    CrInfo.Name := "Multidimensional calculation on server";
    CrInfo.Parent := Mb.Root;
    MDCalc := MB.CreateObject(CrInfo).Edit As IMDCalculation;
    // Add a database
    MDCalc.Database := MB.ItemById("MDDB").Bind As IDatabase;
    // Specify source cube
    Cube := MB.ItemById("CUBE_INPUT").Bind As ICubeModel;
    MDCalc.Sources.AddCube(Cube);
    // Specify destination cube
    MDCalc.Destination.SetCube(MB.ItemById("CUBE_OUTPUT").Bind As ICubeModel);
    // Create a new formulas table
    FormulasTable := MDCalc.FormulasTable;
    TableForFormulas := FormulasTable.Create;
    FormulasTable.Attach(TableForFormulas);
    (MDCalc As IMetabaseObject).Save;
End Sub UserProc;

After executing the example the Multidimensional Calculation on Database Server object is created in the repository root. One source cube and one destination cube are determined, a new formulas table is created.

See also:

IMDCalculationFormulasTable