TimeDependencyEnabled: Boolean;
TimeDependencyEnabled: boolean;
The TimeDependencyEnabled property determines whether time dependency can be set for formulas.
This property returns True if the consumer contains a calendar dimension, otherwise it returns False.
Executing the example requires that the repository contains a database with the DB identifier and two standard cubes with the CUBE_INPUT and CUBE_OUTPUT identifiers. The cube with the CUBE_OUTPUT identifier must contain a calendar dimension.
Add links to the Cubes, Db and Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
MObj: IMetabaseObject;
MDCalc: IMDCalculation;
Cube: ICubeModel;
Source: IMDCalculationSource;
Destination: IMDCalculationDestination;
FormulasTable: IMDCalculationFormulasTable;
TableForFormulas: ITable;
Begin
// Get current repository
MB := MetabaseClass.Active;
// Create an object and set its parameters
CrInfo := MB.CreateCreateInfo;
CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_MDCALCULATION;
CrInfo.Id := MB.GenerateId("MDCALC");
CrInfo.Name := "Multidimensional calculation on server";
CrInfo.Parent := Null;
// Get the Multidimensional Calculation on Server object
MObj := MB.CreateObject(CrInfo).Edit;
MDCalc := MObj As IMDCalculation;
// Add a database
MDCalc.Database := MB.ItemById("DB").Bind As IDatabase;
// Specify source cube
Cube := MB.ItemById("CUBE_INPUT").Bind As ICubeModel;
Source := MDCalc.Sources.AddCube(Cube);
// Specify destination cube
Destination := MDCalc.Destination;
Destination.SetCube(MB.ItemById("CUBE_OUTPUT").Bind As ICubeModel);
// Create a new formulas table
If MDCalc.TimeDependencyEnabled Then
MDCalc.TimeDependent := True;
End If;
FormulasTable := MDCalc.FormulasTable;
TableForFormulas := FormulasTable.Create;
FormulasTable.Attach(TableForFormulas);
// Save Multidimensional Calculation on Server
MObj.Save;
End Sub UserProc;
After executing the example the Multidimensional Calculation on DB Server object is created in the repository root, for which a source cube and a destination cube are set, a new formulas table is created, formula actual period can be enabled.
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;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
MObj: IMetabaseObject;
MDCalc: IMDCalculation;
Cube: ICubeModel;
Source: IMDCalculationSource;
Destination: IMDCalculationDestination;
FormulasTable: IMDCalculationFormulasTable;
TableForFormulas: ITable;
Begin
// Get current repository
MB := Params.Metabase;
// Create an object and set its parameters
CrInfo := MB.CreateCreateInfo();
CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_MDCALCULATION As Int32;
CrInfo.Id := MB.GenerateId("MDCALC", 0);
CrInfo.Name := "Multidimensional calculation on server";
CrInfo.Parent := Null;
// Get the Multidimensional Calculation on Server object
MObj := MB.CreateObject(CrInfo).Edit();
MDCalc := MObj As IMDCalculation;
// Add a database
MDCalc.Database := MB.ItemById["DB"].Bind() As IDatabase;
// Specify source cube
Cube := MB.ItemById["CUBE_INPUT"].Bind() As ICubeModel;
Source := MDCalc.Sources.AddCube(Cube);
// Specify destination cube
Destination := MDCalc.Destination;
Destination.SetCube(MB.ItemById["CUBE_OUTPUT"].Bind() As ICubeModel);
// Create a new formulas table
If MDCalc.TimeDependencyEnabled Then
MDCalc.TimeDependent := True;
End If;
FormulasTable := MDCalc.FormulasTable;
TableForFormulas := FormulasTable.Create(TableForFormulas);
FormulasTable.Attach(TableForFormulas);
// Save Multidimensional Calculation on Server
MObj.Save();
End Sub;
See also: