TreatNullsAsZeros: Boolean;
The TreatNullsAsZeros property determines whether empty values are substituted with zeros on modeling problem calculation.
Empty value is Null.
TreatNullsAsZeros:
True. Empty values in the data of variables are substituted with zeroes on modeling problem calculation. Please note that missing data treatment;
False. The default value. When calculating a modeling problem only missing data treatment methods are applied to empty values in the data of variables.
After calculating a modeling problem the property is set to False.
NOTE. The IMsModel.TreatNullsAsZeros and IMsProblemCalculation.TreatNullsAsZeros properties work together by the OR condition. For example, if the TreatNullsAsZeros model is set to False, and the TreatNullsAsZeros problem calculating this model is set to True, empty values are replaced with zeroes.
This capability enables the user to manage replacing empty values with zeroes both for each model individually and for all models calculated by the problem.
Executing the example requires that the repository includes a modeling container with the MS identifier containing a modeling problem with the PROBLEM identifier.
Add links to the Metabase and Ms system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
Problem: IMsProblem;
CalcSett: IMsProblemCalculationSettings;
Calculation: IMsProblemCalculation;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemByIdNamespace("PROBLEM", MB.ItemById("MS").Key).Edit;
Problem := MObj As IMsProblem;
CalcSett := Problem.CreateCalculationSettings;
Calculation := Problem.Calculate(CalcSett);
Calculation.TreatNullsAsZeros := True;
Calculation.SaveHistory := True;
Calculation.Run;
MObj.Save;
End Sub UserProc;
History of problem calculation, executed during the execution of the example with replacing empty values with zeros, is saved to the modeling container. When incorrect problem is calculated, the calculation history is not saved.
See also: