IModelling.SpliceP

Syntax

SpliceP(Input: ITimeSeries;

SpliceSeries: ITimeSeries;

ComparatorBaseSeries: ITimeSeries;

ComparatorSpliceSeries: ITimeSeries;

[Direction: MsSpliceDirection = 0]): Variant;

Parameters

Input. Input variable.

SpliceSeries. Spliced variable.

ComparatorBaseSeries. Basic variable for comparison block.

ComparatorSpliceSeries. Spliced variable for the comparison block.

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

Description

The SpliceP method transforms the variable based on spliced variables: SpliceSeries / ComparatorSpliceSeries * ComparatorBaseSeries.

Comments

SpliceP executes the percent splice.

Fore Example

Executing the example requires that the repository contains a modeling container with the MS identifier. The container includes a model with the MODEL_D identifier that is calculated by method of determinate equation that contains four input variables.

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, Inp_3, Inp_4: 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;

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

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

TermInfo := Transf.CreateTermInfo;

TermInfo.Slice := Slice;

TermInfo.Type := MsFormulaTermType.Pointwise;

Inp_3 := TermInfo.TermInnerText;

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

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

TermInfo := Transf.CreateTermInfo;

TermInfo.Slice := Slice;

TermInfo.Type := MsFormulaTermType.Pointwise;

Inp_4 := TermInfo.TermInnerText;

Expr := Determ.Expression;

Expr.References := "Ms";

Expr.AsString := "SpliceP(" + Inp_1 + ", " + Inp_2 + ", " + Inp_3 + ", " + Inp_4 + ")";

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 transforms the first input variable on the basis of spliced variables.

Example of Use in Expressions

Expression 1:

SpliceP({Japan|TX},{Japan|TM},{Japan|NX},{Japan|NM},MsSpliceDirection.Both)

Result: suppose that the Japan|TX factor contains the data from January of 1960 to July of 2005, and Japan|NX and Japan|NM - from February of 1940 to December of 2006. SpliceP calculates the relation of the Japan|NX and Japan|NM factors from February 1940 to December 1959 and from August 2005 to December 2006. Then it applies this ratio to the Japan|TX factor, using Japan|TM as denominator.

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:

SpliceP(X1,X2,X3,X4,MsSpliceDirection.Forward)

Result: suppose that the X1 factor contains the data from January to 1960 to July 2005, and X3 and X4 - from February 2003 to December 2006. SpliceP calculates the relation of the X3 and X4 factors from February 2003 to December 2006. Then it applies this ratio and calculates value of the X1 factor using X2 as a denominator.

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

See also:

IModelling