IAlgorithmCalculationResult.HasWarnings

Syntax

HasWarnings: Boolean;

Description

The HasWarnings property returns whether warnings occured on algorithm calculation.

Comments

Available values:

A list of warning messages is set using the IMsProblemCalculationCallback.OnWarning method.

Example

Executing the example requires that the repository contains a ready calculation algorithm with the ALGORITHM identifier. The calculation algorithm should contain configured objects.

Add links to the Algo, Collections, Metabase system assemblies. Add links to the assemblies required for working with calculation algorithms.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObjectDescriptor;
    Algo: ICalcObject;
    CalcAlgo: ICalcAlgorithm;
    CalcResult: IAlgorithmCalculationResult;
    i: Integer;
    Warnings: IStringList;
    Warning: String;
Begin
    MB := MetabaseClass.Active;
    // Get calculation algorithm
    MObj := MB.ItemById("ALGORITHM");
    Algo := CalcObjectFactory.CreateCalcObject(MObj, True);
    CalcAlgo := Algo As ICalcAlgorithm;
    // Calculate algorithm
    CalcResult := CalcAlgo.Calculate;
    // Check if there are warnings on algorithm calculation
    If CalcResult.HasWarnings Then
        Warnings := CalcResult.Errors;
        For i := 0 To Warnings.Count-1 Do
            Warning := Warnings.Item(i);
            // Display list of warnings in the console
            Debug.WriteLine(Warning);
        End For;
    End If;
End Sub UserProc;

After executing the example, the calculation algorithm is calculated. If there are warnings in calculation, the console displays the list of warnings.

See also:

IAlgorithmCalculationResult