IMsProblemCalculation.SaveZeros

Fore Syntax

SaveZeros: Boolean;

Fore.NET Syntax

SaveZeros: boolean;

Description

The SaveZeros property determines the Upload Calculated Zeros to the Base parameter on modeling problem calculation file.

Comments

Available values:

NOTE. The IMsProblemCalculation.SaveZeros and IMsModel.SaveZeros properties work together by the AND condition. For example, if the SaveZeros model is set to True, and the SaveZeros problem calculating this model is set to False, after problem calculation only non-zero values are saved to the database.
This capability enables the user to control zero value saving both for each model 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_SAVEZEROS 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_SAVEZEROS", MB.ItemById("MS").Key).Bind;
    Problem := MObj As IMsProblem;
    CalcSett := Problem.CreateCalculationSettings;
    Calculation := Problem.Calculate(CalcSett);
    Calculation.SaveZeros := False;
    Calculation.SaveData := True;
    Calculation.Run;
End Sub UserProc;

After executing the example the problem is calculated, only non-zero values are saved to database.

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;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Problem: IMsProblem;
    CalcSett: IMsProblemCalculationSettings;
    Calculation: IMsProblemCalculation;
Begin
    MB := Params.Metabase;
    MObj := MB.ItemByIdNamespace["PROBLEM_SAVEZEROS", MB.ItemById["MS"].Key].Bind();
    Problem := MObj As IMsProblem;
    CalcSett := Problem.CreateCalculationSettings();
    Calculation := Problem.Calculate(CalcSett);
    Calculation.SaveZeros := False;
    Calculation.SaveData := True;
    Calculation.Run();
End Sub;

See also:

IMsProblemCalculation