IModelling.Splice

Syntax

Splice(Output: ITimeSeries;

Input: ITimeSeries;

Method: MsSpliceType;

[Direction: MsSpliceDirection = 0;]

[BoundByDates: Boolean = False;]

[StartDate: String = "";]

[EndDate: String = ""]): Variant;

Parameters

Output. Output variable.

Input. Variable that is spliced with the output one.

Method. Splice method.

Direction. Splice direction. Optional parameter. The default value is MsSpliceDirection.Both in both sides.

BoundByDates. The parameter determines whether to use the start (StartDate) and end dates (EndDate) of series splice. False - dates are ignored; True - dates are not ignored and are used for variables splice. Optional parameter. The default value is False.

StartDate. Start date of series splice. Optional parameter. The default value is not set.

EndDate. End date of series splice. Optional parameter. The default value is not set.

Description

The Splice method splices variables.

Fore Example

Executing the example requires that the repository contains a modeling container with the MS identifier. This container includes a model with the MODEL_D identifier that is calculated by method of determinate equation and containing more than one input variable.

Sub UserProc;

Var

Mb: IMetabase;

ModelSpace, ModelObj: IMetabaseObject;

Transf: IMsFormulaTransform;

Formula: IMsFormula;

Model: IMsModel;

Determ: IMsDeterministicTransform;

TransVar: IMsFormulaTransformVariable;

Slice: IMsFormulaTransformSlice;

TermInfo: IMsFormulaTermInfo;

Inp_1, Inp_2: String;

Expr: IExpression;

Begin

Mb := MetabaseClass.Active;

ModelSpace := Mb.ItemById("MS").Bind;

ModelObj := Mb.ItemByIdNamespace("MODEL_D", ModelSpace.Key).Edit;

Model := ModelObj As IMsModel;

Transf := Model.Transform;

Formula := Transf.FormulaItem(0);

Determ := Formula.Method As IMsDeterministicTransform;

TransVar := Transf.Inputs.Item(0);

Slice := TransVar.Slices.Item(0);

TermInfo := Transf.CreateTermInfo;

TermInfo.Slice := Slice;

TermInfo.Type := MsFormulaTermType.Pointwise;

Inp_1 := TermInfo.TermInnerText;

TransVar := Transf.Inputs.Item(1);

Slice := TransVar.Slices.Item(0);

TermInfo := Transf.CreateTermInfo;

TermInfo.Slice := Slice;

TermInfo.Type := MsFormulaTermType.Pointwise;

Inp_2 := TermInfo.TermInnerText;

Expr := Determ.Expression;

Expr.References := "Ms";

Expr.AsString := "Splice(" + Inp_1 + ", " + Inp_2 + ", MsSpliceType.Butt, MsSpliceDirection.Both, True, " + """" + "01.01.2003" + """" + "," + """" + "01.01.2006" + """" + ")";

If Expr.Valid

Then ModelObj.Save;

Else Debug.WriteLine(The model is not saved: error in the formula);

End If;

End Sub UserProc;

After executing the example the model splices values of the first and second input variables.

Example of Use in Expressions

Expression 1:

Splice({Brazil|BCA},{China|BCA},MsSpliceType.Pch,MsSpliceDirection.Backward,False)

Result: values of Brazil|BCA and China|BCA factors are spliced by the splice method of data with rates of change in backward direction.

Use: it can be used in formulas of calculated series of time series database and model formulas of modeling container that is a child of the time series database.

Expression 2:

Splice(X1,X2,MsSpliceType.Butt,MsSpliceDirection.Both,True,"01.01.2002","01.01.2007")

Result: values of X1 and X2 factors are spliced from 2002 to 2007.

Use: it can be used in model formulas of modeling container.

See also:

IModelling