ForecastEndDate: DateTime;
The ForecastEndDate property determines forecasting period end date.
Executing the example requires that the repository contains a workbook with the WORKBOOK identifier. The workbook should contain a time series database. This time series database should contains an indicator with the 1 key with annual data.
Add links to the Cubes, Dimensions, Express, Laner, Metabase, and Ms system assemblies.
Sub Main;
Var
MB: IMetabase;
Workbook: IEaxAnalyzer;
Laner: ILaner;
Series: ILanerSeries;
RubrIn: IRubricatorInstance;
Factor: IRubricatorFactor;
Serie: ILanerCalculateSerie;
VarStub: IVariableStub;
CalcSerie: ILanerCalculateSerie;
TransformModel: IFormulaTransformModel;
FormulaTransform: IMsFormulaTransform;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
Arima: IMsArimaTransform;
TermInfo: IMsFormulaTermInfo;
Begin
// Get the current repository
MB := MetabaseClass.Active;
// Get workbook
Workbook := MB.ItemById("WORKBOOK").Edit As IEaxAnalyzer;
// Get working area of indicators directory
Laner := Workbook.Laner;
// Set start and end dates, on which data will be displayed
Laner.StartDate := DateTime.Parse("01.01.2008");
Laner.EndDate := DateTime.Parse("31.12.2008");
// Get the collection of working area series
Series := Laner.Series;
// Get time series database data
RubrIn := Laner.RubricatorInstance;
// Get a time series of indicator with the 1 key
Factor := RubrIn.GetFactData(1).Factor;
// Add a calculated series based on a time series
Serie := Series.AddCalculateSerieAsSource(Factor);
VarStub := Serie.Stub;
// Add a calculated series named ARIMA
CalcSerie := Series.AddCalculateSerie("ARIMA");
// Set up calculated series parameters
TransformModel := CalcSerie.Transform;
TransformModel.AddInputVariable(VarStub);
TransformModel.IdentificationStartDate := DateTime.Parse("01.01.2000 00:00:00");
TransformModel.IdentificationEndDate := DateTime.Parse("31.12.2007 00:00:00");
TransformModel.ForecastStartDate := DateTime.Parse("01.01.2008 00:00:00");
TransformModel.ForecastEndDate := DateTime.Parse("31.12.2017 00:00:00");
TransformModel.UsePeriod := True;
// Set up calculation method parameters
FormulaTransform := TransformModel.Transform As IMsFormulaTransform;
FormulaTransform.Inputs.Add(VarStub);
Slice := FormulaTransform.Outputs.Item(0).Slices.Add(Null);
Selector := FormulaTransform.CreateSelector;
Selector.Slice := Slice;
Formula := FormulaTransform.Transform(Selector);
Formula.Kind := MsFormulaKind.Arima;
Formula.Level := DimCalendarLevel.Year;
Arima := Formula.Method As IMsArimaTransform;
Slice := FormulaTransform.Inputs.Item(0).Slices.Add(Null);
TermInfo := FormulaTransform.CreateTermInfo;
TermInfo.Slice := Slice;
Arima.Series.Input := TermInfo;
// Save changes
(Workbook As IMetabaseObject).Save;
End Sub Main;
After executing the example the ARIMA new calculated series is added that calculates the indicator with the 1 key using the ARIMA method. The specified sample and forecasting periods are used for calculations.
See also: