OutputPeriod: IMsPeriod;
The OutputPeriod property returns data loading period parameters.
To set up parameters of problem identification and forecasting, use the IMsProblemCalculationSettings.Period property.
Executing the example requires that the repository contains a modeling container with the MS identifier containing a modeling problem with the PROBLEM_TRANSF_OUTPUT identifier.
Add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
MsDescr: IMetabaseObjectDescriptor;
Problem: IMsProblem;
CalcSett: IMsProblemCalculationSettings;
Period: IMsModelPeriod;
ProblemCalc: IMsProblemCalculation;
OutPeriod: IMsDatePeriod;
Begin
Mb := MetabaseClass.Active;
// Get modeling container
MsDescr := Mb.ItemById("MS");
// Get modeling problem
Problem := Mb.ItemByIdNamespace("PROBLEM_TRANSF_OUTPUT", MsDescr.Key).Bind As IMsProblem;
// Create problem calculation options
CalcSett := Problem.CreateCalculationSettings;
// Load data only by the calendar levels,
// which are used in the problem calculation chain
CalcSett.FilterLevelsOnLoad := True;
// Specify calculation period
Period := CalcSett.Period;
Period.IdentificationStartDate := DateTime.Parse("01.01.1990");
Period.IdentificationEndDate := DateTime.Parse("31.12.2009");
Period.ForecastStartDate := DateTime.Parse("01.01.2010");
Period.ForecastEndDate := DateTime.Parse("01.01.2015");
// Get data loading period parameters
OutPeriod := CalcSett.OutputPeriod As IMsDatePeriod;
// Clear parameters of data loading period
OutPeriod.ClearPeriod;
// Set autoperiod parameters: data loading period is determined
// by data loading period of calculated object owner
OutPeriod.AutoPeriod := MsDateAutoPeriodOptions.StartByFact Or MsDateAutoPeriodOptions.EndAsNow;
// Set moving of start and end dates for data loading period
OutPeriod.StartOffset := 1;
OutPeriod.EndOffset := 2;
// Perform calculation
ProblemCalc := Problem.Calculate(CalcSett);
ProblemCalc.Run;
End Sub UserProc;
After executing the example the problem is calculated by identification, forecasting and data loading determined before the calculation. Data
See also: