IMsInterpolateTransform.PatternType

Syntax

PatternType: MsPatternType;

Description

The PatternType property determines pattern type for pattern interpolation.

Comments

To interpolate by pattern, determine a model series by means of the IMsInterpolateTransform.Specified property. Interpolation method is determined by the IMsInterpolateTransform.MethodType property.

Example

Executing the example requires that the repository contains a modeling container with the MS identifier. This modeling container must contain a monthly frequency model with the MODEL_INTERPOLATE identifier calculated by the Interpolation method. It is also required to have a time series database with the TSDB identifier containing annual and monthly frequencies.

Add links to the Cubes, Dimensions, Metabase, Ms, Stat system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    MsKey: Integer;
    Model: IMsModel;
    Stub: IVariableStub;
    Tree: IMsFormulaTransformSlicesTree;
    RubrDescr: IMetabaseObjectDescriptor;
    Transform: IMsFormulaTransform;
    TransformVarables: IMsFormulaTransformVariables;
    TransformVar: IMsFormulaTransformVariable;
    Coord: IMsFormulaTransformCoord;
    Slice: IMsFormulaTransformSlice;
    Interpolate: IMsInterpolateTransform;
    TermInfo: IMsFormulaTermInfo;
    Calcul: IMsMethodCalculation;
    arr: Array 
Of double;
    i: Integer;
    Period: IMsModelPeriod;
Begin
    
// Get current repository
    mb := MetabaseClass.Active;
    
// Get modeling container key
    MsKey := mb.GetObjectKeyById("MS");
    
// Get model
    Model := mb.ItemByIdNamespace("MODEL_INTERPOLATE", MsKey).Edit As IMsModel;
    
// Get object for setting up model parameters
    Transform := Model.Transform;
    
// Get collection of output variables
    TransformVarables := Transform.Outputs;
    
// Get the first output variable  
    TransformVar := TransformVarables.Item(0);
    
// Create output variable calculation parameters
    Coord := Transform.CreateCoord(TransformVar);
    
// Get calculation parameters of the Interpolation method 
    Interpolate := Transform.FormulaItem(0).Method As IMsInterpolateTransform;
    
// Get time series database (TSDB)
    RubrDescr := Mb.ItemById("TSDB");
    
// Cast obtained TSDB to abstract data source
    Stub := RubrDescr.Bind As IVariableStub;
    
// Add a factor to model, which data source is TSDB
    TransformVar := Transform.Inputs.Add(Stub);
    Tree := TransformVar.SlicesTree(TransformVar);
    Slice := Tree.CreateSlice(
2);
    
// Get factor as a term
    TermInfo := Transform.CreateTermInfo;
    TermInfo.Slice := Slice;
    
// Specify obtained term as input variable
    Interpolate.Input := TermInfo;
    
// Specify original frequency
    Interpolate.InputLevel := DimCalendarLevel.Year;
    
// Specify missing data treatment method
    Interpolate.MissingData.Method := MissingDataMethod.LinTrend;
    
// Set interpolation type: pattern
    Interpolate.MethodType := MsInterpolateType.Pattern;
    
// Set pattern type
    Interpolate.PatternType := MsPatternType.Average;
    
// Add a factor to model, which data source is TSDB
    TransformVar := Transform.Inputs.Add(Stub);
    Tree := TransformVar.SlicesTree(TransformVar);
    Slice := Tree.CreateSlice(
3);
    
// Get factor as a term
    TermInfo := Transform.CreateTermInfo;
    TermInfo.Slice := Slice;
    
// Specify added factor as a pattern series
    Interpolate.Specified := TermInfo;
    
// Create an object with model calculation parameters
    Calcul := Transform.CreateCalculation;
    
// Set calculation periods
    Period := Model.Transform.Period;
    Calcul.Period.IdentificationStartDate := Period.IdentificationStartDate;
    Calcul.Period.IdentificationEndDate := Period.IdentificationEndDate;
    Calcul.Period.ForecastStartDate := Period.ForecastStartDate;
    Calcul.Period.ForecastEndDate := Period.ForecastEndDate;
    Calcul.CurrentPoint := Period.IdentificationStartDate;
    
// Get output model data
    arr := Interpolate.CalculateSeries(Calcul, Coord).Modelling;
    
// Output name and data of output variable in the console window
    Debug.WriteLine(Interpolate.Result.TermInfo.TermText);
    
For i := 0 To arr.Length - 1 Do
        Debug.WriteLine(arr[i]);
    
End For;
    
// Save changes in model 
    (Model As IMetabaseObject).Save;
End Sub UserProc;

After executing the example calculation settings of the MODEL_INTERPOLATE model are changed: output variable is changed, interpolation calculation method is changed, and so on. Calculation results are displayed in the console window.

See also:

IMsInterpolateTransform