AddInputVariable(Variable: IVariableStub);
Variable. Added series.
The AddInputVariable property adds an input series.
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 UserProc;
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;
// 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);
// 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 UserProc;
After executing the example the ARIMA new calculated series is added in the workbook that calculates the indicator with the 1 key using the ARIMA method.
See also: