IMsMethodCalculation.Warnings

Syntax

Warnings: 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.

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 options
    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 loading 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.

See also:

IMsMethodCalculation