SaveZeros: Boolean;
SaveZeros: boolean;
The SaveZeros property determines the Upload Calculated Zeros to the Base parameter on modeling problem calculation file.
Available values:
True. The default value. Zero values obtained on problem calculation are unloaded to database.
False. After problem calculation only non-zero values are saved in database.
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.
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.
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: