IAlgorithmCalculationResult.HasError

Syntax

HasError: Boolean;

None;

Description

The HasError property returns whether errors occurred on algorithm calculation.

Comments

Available values:

The list of error messages is set using the IMsProblemCalculationCallback.OnError method.

Example

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

Add a link to the Calculation Algorithm Core custom assembly contained in the Calculation Algorithms component, and links to the Algo, Collections, Metabase system assemblies.

Sub UserProc;
Var
    
MB: IMetabase;
    MObj: IMetabaseObjectDescriptor;
    Algo: ICalcObject;
    CalcAlgo: ICalcAlgorithm;
    CalcResult: IAlgorithmCalculationResult;
    i: Integer;
    Errors: IStringList;
    Error: 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 errors on algorithm calculation
    If CalcResult.HasError Then
        Errors := CalcResult.Errors;
        
For i := 0 To Errors.Count-1 Do
            
Error := Errors.Item(i);
            // Display error message in the console
            Debug.WriteLine(Error);
        
End For;
    
End If;
End Sub UserProc;

Not provisioned.

After executing the example, the calculation algorithm is calculated. If errors occurred in calculation, the console displays error messages.

See also:

IAlgorithmCalculationResult