IMsModelPeriod.AutoPeriod

Fore Syntax

AutoPeriod: Integer;

Fore.NET 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

Fore 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, 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.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:

Fore.NET Example

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;
    MsKey: uinteger;
    ModelObj: IMetabaseObject;
    Model: IMsModel;
    ModelPeriod: IMsModelPeriod;
    AutoPeriod: integer;
Begin
    mb := Params.Metabase;
    MsKey := mb.ItemById["MS"].Key;
    ModelObj := mb.ItemByIdNamespace["MODEL", MsKey].Edit();
    Model := ModelObj As IMsModel;
    Model.UseModelPeriod := True;
    ModelPeriod := Model.Period;
    ModelPeriod.AutoPeriod := (MsAutoPeriodOptions.msapoIdentStartAsNow As integer) +
        (MsAutoPeriodOptions.msapoIdentEndAsNow As integer) +
        (MsAutoPeriodOptions.msapoForecastStartAsNow As integer) +
        (MsAutoPeriodOptions.msapoForecastEndByIdentEnd As integer);
    ModelPeriod.IdentificationStartOffset := -10;
    ModelPeriod.IdentificationEndOffset := 0;
    ModelPeriod.UseForecastStart := True;
    ModelPeriod.ForecastStartOffset := 1;
    ModelPeriod.ForecastEndOffset := 5;
    ModelObj.Save();
End Sub;

See also:

IMsModelPeriod