IMsMethodCalculation.Warnings

Fore Syntax

Warnings: IStringList;

Fore.NET Syntax

Warnings: System.Collections.Generic.IList.IStringList;

Description

The Warnings property returns the warnings that occurred at method calculation.

Comments

Warnings are returned as the dynamic array of strings.

If the warnings appear during the calculation, the calculation is not interrupted.

Fore Example

Executing the example requires that the repository contains a modeling container with the MS identifier, containing a model with the MODEL_FREEDIM identifier.

Add links to the Collections, Metabase, Ms system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    DescrCM: IMetabaseObjectDescriptor;
    pModel: IMsModel;
    trans: IMsFormulaTransform;
    coo: IMsFormulaTransformCoord;
    calc: IMsMethodCalculation;
    Period: IMsModelPeriod;
    OutputPeriod: IMsDatePeriod;
    i: integer;
    Method: IMsMethod;
Begin
    // Get the model
    mb := MetabaseClass.Active;
    DescrCM := mb.ItemById("MS");
    pModel := mb.ItemByIdNamespace("MODEL_FREEDIM", DescrCM.Key).Edit As IMsModel;
    // Set calculation parameters
    trans := pModel.Transform;
    coo := trans.CreateCoord(trans.Outputs.Item(0));
    calc := trans.CreateCalculation;
    // Set calculation periods
    Period := pModel.Transform.Period;
    calc.Period.IdentificationStartDate := Period.IdentificationStartDate;
    calc.Period.IdentificationEndDate := Period.IdentificationEndDate;
    calc.Period.ForecastStartDate := Period.ForecastStartDate;
    calc.Period.ForecastEndDate := Period.ForecastEndDate;
    calc.CurrentPoint := Period.IdentificationStartDate;
    // Set data uploading period
    OutputPeriod := calc.OutputPeriod As IMsDatePeriod;
    // Clear parameters of data unloading period
    OutputPeriod.ClearPeriod;
    // Set data uploading start and end period dates
    OutputPeriod.Start := DateTime.Parse("01.01.2010");
    OutputPeriod.End_ := DateTime.Parse("01.01.2016");
    // Output information about whether empty selection is enabled
    If calc.AllowEmptySelection
        Then Debug.WriteLine("Empty selection is enabled");
        Else Debug.WriteLine("Empty selection is disabled");
    End If;
    // Calculate the model
    Method := trans.FormulaItem(0).Method;
    Method.Execute(calc, coo);
    // Display the warning in the console window
    For i := 0 To calc.Warnings.Count - 1 Do
        Debug.WriteLine(calc.Warnings.Item(i));
    End For;
End Sub UserProc;

Example execution result: the MODEL_FREEDIM model is calculated, warnings occurred during the calculation are displayed in the console window.

Fore.NET Example

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

Imports Prognoz.Platform.Interop.ForeCollections;
Imports Prognoz.Platform.Interop.Ms;

Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
    DescrCM: IMetabaseObjectDescriptor;
    pModel: IMsModel;
    trans: IMsFormulaTransform;
    coo: IMsFormulaTransformCoord;
    calc: IMsMethodCalculation;
    Period: IMsModelPeriod;
    OutputPeriod: IMsDatePeriod;
    i: integer;
    Method: IMsMethod;
Begin
    // Get the model
    mb := Params.Metabase;
    DescrCM := mb.ItemById["MS"];
    pModel := mb.ItemByIdNamespace["MODEL_FREEDIM", DescrCM.Key].Edit() As IMsModel;
    // Set calculation parameters
    trans := pModel.Transform;
    coo := trans.CreateCoord(trans.Outputs.Item[0]);
    calc := trans.CreateCalculation();
    // Set calculation periods
    Period := pModel.Transform.Period;
    calc.Period.IdentificationStartDate := Period.IdentificationStartDate;
    calc.Period.IdentificationEndDate := Period.IdentificationEndDate;
    calc.Period.ForecastStartDate := Period.ForecastStartDate;
    calc.Period.ForecastEndDate := Period.ForecastEndDate;
    calc.CurrentPoint := Period.IdentificationStartDate;
    // Set data uploading period
    OutputPeriod := calc.OutputPeriod As IMsDatePeriod;
    // Clear parameters of data unloading period
    OutputPeriod.ClearPeriod();
    // Set data uploading start and end period dates
    OutputPeriod.Start := DateTime.Parse("01.01.2010");
    OutputPeriod.@End := DateTime.Parse("01.01.2016");
    // Output information about whether empty selection is enabled
    If calc.AllowEmptySelection
        Then System.Diagnostics.Debug.WriteLine("Empty selection is enabled");
        Else System.Diagnostics.Debug.WriteLine("Empty selection is disabled");
    End If;
    // Calculates model  
    Method := trans.FormulaItem[0].Method;
    Method.Execute(calc, coo);
    // Display the warning in the console window
    For i := 0 To calc.Warnings.Count - 1 Do
        System.Diagnostics.Debug.WriteLine(calc.Warnings.Item[i]);
    End For;
End Sub;

See also:

IMsMethodCalculation