CreateFormulasConverter(Cube: ICalculatedCubeInstance): IMDCalculationFormulasConverter;
CreateFormulasConverter(Cube: Prognoz.Platform.Interop.Cubes.ICalculatedCubeInstance): Prognoz.Platform.Interop.Cubes.IMDCalculationFormulasConverter;
Cube. Calculated cube, to which formulas from multidimensional calculation must be converted.
The CreateFormulasConverter method creates an object that is used to convert formulas from multidimensional calculation into calculated cube.
Executing the example requires that the repository contains multidimensional calculation on DB server with the MDCalc identifier and a calculated cube with the CalcCube identifier. The multidimensional calculation and the calculated cube must be based on equal data sources.
Sub UserProc;
Var
MB: IMetabase;
CalcCubeInst: ICalculatedCubeInstance;
MDCalcInst: IMDCalculationInstance;
FConverter: IMDCalculationFormulasConverter;
bStruct: Boolean = False;
StructError: String;
Begin
MB := MetabaseClass.Active;
CalcCubeInst := MB.ItemById("CalcCube").Open(Null) As ICalculatedCubeInstance;
MDCalcInst := MB.ItemById("MDCalc").Open(Null) As IMDCalculationInstance;
FConverter := MDCalcInst.CreateFormulasConverter(CalcCubeInst);
FConverter.CorrectSourceFormulas := True;
Try
//Check correspondence of multidimensional calculation structures
//and calculated cube
FConverter.ValidateStructure;
bStruct := True;
Except On e: Exception Do
StructError := e.Message;
End Try;
If Not bStruct Then
Debug.WriteLine(Structures of multidimensional calculation and calculated cube are not compatible);
Debug.WriteLine(Error: + StructError);
Else
//Convert formulas
FConverter.BatchMode := ConvertBatchMode.Update;
FConverter.Convert;
CalcCubeInst.SaveFormulas;
End If;
End Sub UserProc;
On executing the example structures of multidimensional calculation and calculated cube are checked for correspondence. If the structures are similar, formulas in the calculated cube will be updated according to the formulas of the multidimensional calculation. Formulas of the multidimensional calculation will be adjusted before converting to the calculated cube.
Executing the example requires that the repository contains multidimensional calculation on DB server with the MDCalc identifier and a calculated cube with the CalcCube identifier. The multidimensional calculation and the calculated cube must be based on equal data sources.
Imports System.Diagnostics;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
CalcCubeInst: ICalculatedCubeInstance;
MDCalcInst: IMDCalculationInstance;
FConverter: IMDCalculationFormulasConverter;
bStruct: Boolean = False;
StructError: String;
Begin
MB := Params.Metabase;
CalcCubeInst := MB.ItemById["CalcCube"].Open(Null) As ICalculatedCubeInstance;
MDCalcInst := MB.ItemById["MDCalc"].Open(Null) As IMDCalculationInstance;
FConverter := MDCalcInst.CreateFormulasConverter(CalcCubeInst);
FConverter.CorrectSourceFormulas := True;
Try
//Check correspondence of multidimensional calculation structures
//and calculated cube
FConverter.ValidateStructure();
bStruct := True;
Except On e: Exception Do
StructError := e.Message;
End Try;
If Not bStruct Then
Debug.WriteLine(Structures of multidimensional calculation and calculated cube are not compatible);
Debug.WriteLine(Error: + StructError);
Else
//Convert formulas
FConverter.BatchMode := ConvertBatchMode.cbmUpdate;
FConverter.Convert();
CalcCubeInst.SaveFormulas();
End If;
End Sub;
The specified procedure is an entry point for the .NET assembly. On executing the example structures of multidimensional calculation and calculated cube are checked for correspondence. If the structures are similar, formulas in the calculated cube will be updated according to the formulas of the multidimensional calculation. Formulas of the the multidimensional calculation will be adjusted before conversion to the calculated cube.
See also: