IMsModelPeriod.AutoPeriod

Syntax

AutoPeriod: Integer;

Description

The AutoPeriod property determines the conditions that are used to calculate start and end dates of sample and forecasting periods.

Comments

The value is determined by combinations of the MsAutoPeriodOptions enumeration elements. AutoPeriod is taken into account if the IMsModel.UseModelPeriod property is set to True.

If AutoPeriod uses the value of the MsAutoPeriodOptions enumeration, which requires setting additional number of periods, for example, MsAutoPeriodOptions.IdentStartByIdentEnd or MsAutoPeriodOptions.ForecastEndByFact, specify additional parameters in the corresponding property:

Features of calculation start and end dates of sample and forecasting periods

Example

Executing the example requires a modeling container with the MS identifier that contains a model with the MODEL identifier.

Add links to the Metabase and Ms system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    MsKey: Integer;
    ModelObj: IMetabaseObject;
    Model: IMsModel;
    ModelPeriod: IMsModelPeriod;
Begin
    // Получаем текущий репозиторий
    mb := MetabaseClass.Active;
    // Получаем модель
    MsKey := mb.ItemById("MS").Key;
    ModelObj := mb.ItemByIdNamespace("MODEL", MsKey).Edit;
    Model := ModelObj As IMsModel;
    Model.UseModelPeriod := True;
    // Получаем периоды модели
    ModelPeriod := Model.Transform.Period;
    // Задаём условия периода расчёта
    ModelPeriod.AutoPeriod := MsAutoPeriodOptions.IdentStartAsNow +
        MsAutoPeriodOptions.IdentEndAsNow +
        MsAutoPeriodOptions.ForecastStartAsNow +
        MsAutoPeriodOptions.ForecastEndByIdentEnd;
    ModelPeriod.IdentificationStartOffset := -10;
    ModelPeriod.IdentificationEndOffset := -1;
    ModelPeriod.UseForecastStart := True;
    ModelPeriod.ForecastStartOffset := 1;
    ModelPeriod.ForecastEndOffset := 5;
    // Сохраняем изменения
    ModelObj.Save;
End Sub UserProc;

After executing the example the conditions that determine model calculation periods are set:

See also:

IMsModelPeriod