IMsModelCalculation.ClearSeriesOnWarning

Fore Syntax

ClearSeriesOnWarning: Boolean;

Fore.NET Syntax

ClearSeriesOnWarning: boolean;

Description

The ClearSeriesOnWarning property determines whether the output series is empty on occurring the warning.

Comments

Available values:

Fore Example

Executing the example requires that the repository contains a modeling container with the MS identifier which contains a non-linear regression model (OLS estimation) with the MODEL identifier.

Add links to the Metabase, Ms system assemblies.

Sub UserCalc;
Var
    MB: IMetabase;
    Model: IMsModel;
    Transform: IMsFormulaTransform;
    VarTrans: IMsFormulaTransformVariable;
    Tree: IMsFormulaTransformSlicesTree;
    Slice: IMsFormulaTransformSlice;
    Selector: IMsFormulaTransformSelector;
    Formula: IMsFormula;
    LinReg: IMsLinearRegressionTransform;
    Coord: IMsFormulaTransformCoord;
    Calc: IMsModelCalculation;
    CalcRes: IMsModelCalculationResult;
Begin
    MB := MetabaseClass.Active;
    // Get the model
    Model := MB.ItemByIdNamespace("MODEL", MB.ItemById("MS").Key).Edit As IMsModel;
    // Get model calculation parameters
    Transform := Model.Transform;
    VarTrans := Transform.Outputs.Item(0);
    Tree := VarTrans.SlicesTree(VarTrans);
    Slice := Tree.CreateSlice(1);
    Selector := Model.Output.Item(0).Transform.CreateSelector;
    Selector.Slice := Slice;
    Formula := Model.Transform.Transform(Selector);
    // Prepare model calculation
    LinReg := Formula.Method As IMsLinearRegressionTransform;
    Coord := Model.Transform.CreateCoord(VarTrans);
    Calc := Model.CreateCalculation;
    // Set calculation periods
    Calc.Period.IdentificationStartDate := DateTime.Parse("01.01.1990");
    Calc.Period.IdentificationEndDate := DateTime.Parse("31.12.2009");
    Calc.Period.ForecastStartDate := DateTime.Parse("01.01.2010");
    Calc.Period.ForecastEndDate := DateTime.Parse("31.12.2013");
    // Set mode of data output to output series
    Calc.ClearSeriesOnWarning := True;
    // Perform model identification
    LinReg.Identify(Calc As IMsMethodCalculation, Coord);
    // Save changes
    (Model As IMetabaseObject).Save;
End Sub UserCalc;

After executing the example the model is calculated for the specified period. If on calculating the warning occurred, the output series is cleared.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Ms;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Model: IMsModel;
    Transform: IMsFormulaTransform;
    VarTrans: IMsFormulaTransformVariable;
    Tree: IMsFormulaTransformSlicesTree;
    Slice: IMsFormulaTransformSlice;
    Selector: IMsFormulaTransformSelector;
    Formula: IMsFormula;
    LinReg: IMsLinearRegressionTransform;
    Coord: IMsFormulaTransformCoord;
    Calc: IMsModelCalculation;
    CalcRes: IMsModelCalculationResult;
Begin
    MB := Params.Metabase;
    // Get the model
    Model := MB.ItemByIdNamespace["MODEL", MB.ItemById["MS"].Key].Edit() As IMsModel;
    // Get model calculation parameters
    Transform := Model.Transform;
    VarTrans := Transform.Outputs.Item[0];
    Tree := VarTrans.SlicesTree[VarTrans];
    Slice := Tree.CreateSlice(1);
    Selector := Model.Output.Item[0].Transform.CreateSelector();
    Selector.Slice := Slice;
    Formula := Model.Transform.Transform[Selector];
    // Prepare model calculation
    LinReg := Formula.Method As IMsLinearRegressionTransform;
    Coord := Model.Transform.CreateCoord(VarTrans);
    Calc := Model.CreateCalculation();
    // Set calculation periods
    Calc.Period.IdentificationStartDate := DateTime.Parse("01.01.1990");
    Calc.Period.IdentificationEndDate := DateTime.Parse("31.12.2009");
    Calc.Period.ForecastStartDate := DateTime.Parse("01.01.2010");
    Calc.Period.ForecastEndDate := DateTime.Parse("31.12.2013");
    // Set mode of data output to output series
    Calc.ClearSeriesOnWarning := True;
    // Perform model identification
    LinReg.Identify(Calc As IMsMethodCalculation, Coord);
    // Save changes
    (Model As IMetabaseObject).Save();
End Sub;

See also:

IMsModelCalculation