Period: IMsModelPeriod;
Period: Prognoz.Platform.Interop.Ms.IMsModelPeriod;
The Period property returns model calculation period.
The property allows to set the following parameters of model calculation period:
Sample period start date | Sample period end date | Forecasting period start date |
Specified date (default). | Specified date (default). | Specified date (default). |
Today plus/minus k points. | Today plus/minus k points. | Today plus/minus k points. |
Start of data plus/minus k points. | End of data plus/minus k points. | End of data plus/minus k points. |
Sample period end minus k points. | Sample period start plus k points. | Sample period end plus k points. |
Setting value by parameter. | Setting value by parameter. | Setting value by parameter. |
Start of data plus k points. |
NOTE. Value cannot be set by parameter for the models used in series mode of the time series database.
Executing the example requires that the repository contains a modeling container with the MS identifier. This container must have a metamodel with the METAMODEL_PERIOD identifier including calculation chain with the MODEL_PERIOD identifier.
Add links to the Dal, Dimensions, Metabase, Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
MsKey: Integer;
MetaModel: IMsMetaModel;
pParams: IMsModelParams;
pPar: IMsModelParam;
pModel: IMsModel;
pPeriod: IMsModelPeriod;
Begin
// Get current repository
mb := MetabaseClass.Active;
// Get modelling container key
MsKey := mb.GetObjectKeyById("MS");
// Get metamodel
MetaModel := mb.ItemByIdNamespace("METAMODEL_PERIOD", MsKey).Edit As IMsMetaModel;
// Get metamodel parameters
pParams := MetaModel.Params;
// Remove all parameters
pParams.Clear;
// Add metamodel parameter for creating sample period start
pPar := pParams.Add;
pPar.Id := "IDSTART";
pPar.Name := "Sample period";
pPar.DataType := DbDataType.Date;
pPar.DefaultValue := DateTime.Parse("01.01.1995");
// Add metamodel parameter for setting sample period end
pPar := pParams.Add;
pPar.Id := "IDEND";
pPar.Name := "Identification end";
pPar.DataType := DbDataType.Date;
pPar.DefaultValue := DateTime.Parse("01.01.2015");
// Save changes of the metamodel
(MetaModel As IMetabaseObject).Save;
// Get the model
pModel := mb.ItemByIdNamespace("MODEL_PERIOD", MsKey).Edit As IMsModel;
// Set daily calculation frequency for model
pModel.Transform.FormulaItem(0).Level := DimCalendarLevel.Day;
// Get model calculation period parameters
pPeriod := pModel.Transform.Period;
// Set parameters for model that determine sample period start and end
pPeriod.IdentificationStartDateParamID := "IDSTART";
pPeriod.IdentificationEndDateParamID := "IDEND";
// Save changes in the model
(pModel As IMetabaseObject).Save;
End Sub UserProc;
After executing the example, start and end of the model sample period are set by the DSTART and IDEND parameters.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Dal;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Ms;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
MsKey: uinteger;
MetaModel: IMsMetaModel;
pParams: IMsModelParams;
pPar: IMsModelParam;
pModel: IMsModel;
pPeriod: IMsModelPeriod;
Begin
// Get current repository
mb := Params.Metabase;
// Get modelling container key
MsKey := mb.GetObjectKeyById("MS");
// Get metamodel
MetaModel := mb.ItemByIdNamespace["METAMODEL_PERIOD", MsKey].Edit() As IMsMetaModel;
// Get metamodel parameters
pParams := MetaModel.Params;
// Remove all parameters
pParams.Clear();
// Add metamodel parameter for creating sample period start
pPar := pParams.Add();
pPar.Id := "IDSTART";
pPar.Name := "Sample period";
pPar.DataType := DbDataType.ddtDate;
pPar.DefaultValue := DateTime.Parse("01.01.1995");
// Add metamodel parameter for setting sample period end
pPar := pParams.Add();
pPar.Id := "IDEND";
pPar.Name := "Identification end";
pPar.DataType := DbDataType.ddtDate;
pPar.DefaultValue := DateTime.Parse("01.01.2015");
// Save changes of the metamodel
(MetaModel As IMetabaseObject).Save();
// Get the model
pModel := mb.ItemByIdNamespace["MODEL_PERIOD", MsKey].Edit() As IMsModel;
// Set daily calculation frequency for model
pModel.Transform.FormulaItem[0].Level := DimCalendarLevel.dclDay;
// Get model calculation period parameters
pPeriod := pModel.Transform.Period;
// Set parameters for model that determine sample period start and end
pPeriod.IdentificationStartDateParamID := "IDSTART";
pPeriod.IdentificationEndDateParamID := "IDEND";
// Save changes in the model
(pModel As IMetabaseObject).Save();
End Sub;
See also: