HasWarnings: Boolean;
None;
The HasWarnings property returns whether warnings occured on algorithm calculation.
Available values:
True. Warnings occurred on algorithm calculation.
False. Warnings did not occur on algorithm calculation.
A list of warning messages is set using the IMsProblemCalculationCallback.OnWarning method.
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;
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;
Not provisioned.
After executing the example, the calculation algorithm is calculated. If there are warnings in calculation, the console displays the list of warnings.
See also: