HasError: Boolean;
The HasError property returns whether errors occurred on algorithm calculation.
Available values:
True. Errors occurred on algorithm calculation.
False. Errors did not occur on algorithm calculation.
The list of error messages is set using the IMsProblemCalculationCallback.OnError method.
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;
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;
After executing the example, the calculation algorithm is calculated. If errors occurred in calculation, the console displays error messages.
See also: