TreatNullsAsZeros: Boolean;
TreatNullsAsZeros: boolean;
The TreatNullsAsZeros property determines the Substitute Empty Values with Zeros parameter on modeling problem calculation.
Empty value is Null.
TreatNullsAsZeros:
True. Empty values in the data of variables are replaced with zeroes on modeling problem calculation. Please note that missing data treatment will work.
False. The default value. On calculating the modeling problem only missing data treatment methods are applied to empty values in the data of variables.
After calculating the 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 contains a modeling container with the MS identifier, containing a modeling problem with the PROBLEM identifier.
Add links to the Metabase, 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, performed during the execution of the example with replacing empty values with zeros, is saved to the modeling container. On calculate incorrect problem, the calculation history is not saved.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Ms;
…
Sub UserProc(Params: StartParams);
Var
MB: IMetabase;
MObj: IMetabaseObject;
Problem: IMsProblem;
CalcSett: IMsProblemCalculationSettings;
Calculation: IMsProblemCalculation;
Begin
MB := Params.Metabase;
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;
See also: