Period: Object;
Period: object;
The Period property returns formula calculation period.
To work with value returned by this property, bring it to the IMsModelPeriod interface.
Executing the example requires that the repository contains an express report with the EXPRESS_TRANSF_PERIOD identifier containing calculated element in a dimension.
Add links to the Dimensions, Express, Metabase, Ms system asseblies.
Sub UserProc;
Var
mb: IMetabase;
Analyzer: IEaxAnalyzer;
Slice: IEaxDataAreaSlice;
Transforms: IEaxDataAreaTransformations;
Transf: IEaxDataAreaTransformation;
Period: IMsModelPeriod;
OutputPeriod: IMsDatePeriod;
Begin
// Get express report
mb := MetabaseClass.Active;
Analyzer := mb.ItemById("EXPRESS_TRANSF_PERIOD").Edit As IEaxAnalyzer;
// Get slice by which table is built
Slice := Analyzer.Grid.Slice;
// Get formulas of calculated elements
Transforms := Slice.CalcTransformations;
// Get formula of the first element
Transf := Transforms.Item(0);
// Set formula calculation period
Period := Transf.Period As IMsModelPeriod;
Period.IdentificationStartDate := DateTime.Parse("01.01.1990");
Period.IdentificationEndDate := DateTime.Parse("01.01.2010");
Period.ForecastStartDate := DateTime.Parse("01.01.2010");
Period.ForecastEndDate := DateTime.Parse("01.01.2020");
// Set data unloading period
OutputPeriod := Transf.OutputPeriod As IMsDatePeriod;
OutputPeriod.Start := DateTime.Parse("01.01.1990");
OutputPeriod.End_ := DateTime.Parse("01.01.2020");
// Set formula calendar frequency
Transf.Level := DimCalendarLevel.Year;
// Save changes
(Analyzer As IMetabaseObject).Save;
End Sub UserProc;
After executing the example calculation period and data unloading period will be changed for the first calculated element of dimension.
The requirements and result of the Fore.NET Example execution match with those in the Fore Example.
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Ms;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
Analyzer: IEaxAnalyzer;
Slice: IEaxDataAreaSlice;
Transforms: IEaxDataAreaTransformations;
Transf: IEaxDataAreaTransformation;
Period: IMsModelPeriod;
OutputPeriod: IMsDatePeriod;
Begin
// Get express report
mb := Params.Metabase;
Analyzer := mb.ItemById["EXPRESS_TRANSF_PERIOD"].Edit() As IEaxAnalyzer;
// Get slice by which table is built
Slice := Analyzer.Grid.Slice;
// Get formulas of calculated elements
Transforms := Slice.CalcTransformations;
// Get formula of the first element
Transf := Transforms.Item[0];
// Set formula calculation period
Period := Transf.Period As IMsModelPeriod;
Period.IdentificationStartDate := DateTime.Parse("01.01.1990");
Period.IdentificationEndDate := DateTime.Parse("01.01.2010");
Period.ForecastStartDate := DateTime.Parse("01.01.2010");
Period.ForecastEndDate := DateTime.Parse("01.01.2020");
// Set data unloading period
OutputPeriod := Transf.OutputPeriod As IMsDatePeriod;
OutputPeriod.Start := DateTime.Parse("01.01.1990");
OutputPeriod.@End := DateTime.Parse("01.01.2020");
// Set formula calendar frequency
Transf.Level := DimCalendarLevel.dclYear;
// Save changes
(Analyzer As IMetabaseObject).Save();
End Sub;
See also: