BreakOnError: Boolean;
BreakOnError: boolean;
The BreakOnError property determines whether modeling problem execution should be aborted when an error occurred.
Available values:
True. On occurring an error the calculation of modeling problem is aborted.
False. The default value. On occurring an error the calculation of modeling problem is continued.
The property value is taken into account only on the step of problem calculation. If error occurred on data loading or initializing, the calculation is aborted regardless the value of BreakOnError.
Executing the example requires a modeling problem with the 13380 key. Add links to the Metabase, Ms system assemblies. Also, the MCallback class, the description of which is given in IMsproblemCalculationCallback.OnWarning is used in the example.
Sub UserProc;
Var
mb: IMetabase;
Problem: IMsProblem;
Calculation: IMsProblemCalculation;
CallBack: MCallback;
CalcSettings: IMsProblemCalculationSettings;
Begin
mb := MetabaseClass.Active;
Problem := mb.Item(13380).Bind As IMsProblem;
CallBack := New MCallback.Create;
CalcSettings := Problem.CreateCalculationSettings;
CalcSettings.Callback := CallBack;
CalcSettings.FactIncluded := True;
CalcSettings.BreakOnError := True;
Calculation := Problem.Calculate(CalcSettings);
Calculation.Run;
End Sub UserProc;
After executing the example the problem is calculated. If there is an error, the calculation is stopped. The handler of the events occurring on problem calculation is the MCallback class.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Ms;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
Problem: IMsProblem;
Calculation: IMsProblemCalculation;
CallBack: MCallback;
CalcSettings: IMsProblemCalculationSettings;
Begin
mb := Params.Metabase;
Problem := mb.Item[13380].Bind() As IMsProblem;
CallBack := New MCallback.Create();
CalcSettings := Problem.CreateCalculationSettings();
CalcSettings.Callback := CallBack;
CalcSettings.FactIncluded := True;
CalcSettings.BreakOnError := True;
Calculation := Problem.Calculate(CalcSettings);
Calculation.Run();
End Sub;
See also: