Period: IMsModelPeriod;
The Period property returns the 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 modeling container with the MS identifier. This container must contain a metamodel with the METAMODEL_PERIOD identifier including a model with the MODEL_PERIOD identifier to the calculation chain.
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";
// Display calendar element calculation method in the console
Debug.WriteLine(pModel.Transform.CalendarMode);
// Save changes in model
(pModel As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the start and end of the model identification period will be set by the IDSTART and IDEND parameters. The console displays calendar element calculation method.
See also: