IMsProblemCalculation.TreatNullsAsZeros

Fore Syntax

TreatNullsAsZeros: Boolean;

Fore.NET Syntax

TreatNullsAsZeros: boolean;

Description

The TreatNullsAsZeros property determines the Substitute Empty Values with Zeros parameter on  modeling problem calculation.

Comments

Empty value is Null.

TreatNullsAsZeros:

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.

Fore Example

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.

Fore.NET Example

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:

IMsProblemCalculation