IMsModelPeriod.AutoPeriodDates

Fore Syntax

AutoPeriodDates(Calculation: IMsMethodCalculation;
    Coord: IMsFormulaTransformCoord;
    Var IdentificationAutoStartDate: DateTime;
    Var IdentificationAutoEndDate: DateTime;
    Var ForecastAutoStartDate: DateTime;
    Var ForecastAutoEndDate: DateTime);

Fore.NET Syntax

AutoPeriodDates(Calculation: Prognoz.Platform.Interop.Ms.IMsMethodCalculation;
    Coord: Prognoz.Platform.Interop.Ms.IMsFormulaTransformCoord;
    Var IdentificationAutoStartDate: System.DateTime;
    Var IdentificationAutoEndDate: System.DateTime;
    Var ForecastAutoStartDate: System.DateTime;
    Var ForecastAutoEndDate: System.DateTime);

Parameters

Calculation. Settings that are necessary on model calculation.

Coord. Coordinate parameters in the variable by which the calculation is executed.

IdentificationAutoStartDate. Identification start.

IdentificationAutoEndDate. Identification end.

ForecastAutoStartDate. Forecast start.

ForecastAutoEndDate. Forecast end.

Description

The AutoPeriodDates method returns limits of model calculation period if conditions are used for calculating start and end dates of sample and forecasting periods.

Comments

The criterion of using the conditions for calculating of model calculation period limits is returned by the IMsModel.UseAutoPeriod property.

The IdentificationAutoStartDate, IdentificationAutoEndDate, ForecastAutoStartDate and ForecastAutoEndDate parameters must be variables. After executing the method they contain the results.

Fore Example

Executing the example requires a modeling container with the CONT_MODEL identifier that contains a model with the MODEL identifier. The model calculation period limits are determined by conditions. Add links to the Metabase, Ms system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    MsKey: Integer;
    Model: IMsModel;
    ModelPeriod: IMsModelPeriod;
    Calc: IMsMethodCalculation;
    Transform: IMsFormulaTransform;
    Coord: IMsFormulaTransformCoord;
    IdentStart, IdentEnd, ForeStart, ForeEnd: DateTime;
Begin
    mb := MetabaseClass.Active;
    MsKey := mb.ItemById("CONT_MODEL").Key;
    Model := mb.ItemByIdNamespace("MODEL", MsKey).Bind As IMsModel;
    ModelPeriod := Model.Period;
    If Model.UseAutoPeriod Then
        Calc := Model.CreateCalculation As IMsMethodCalculation;
        Transform := Model.Transform;
        Coord := Transform.CreateCoord(Transform.Outputs.Item(0));
        ModelPeriod.AutoPeriodDates(Calc, Coord, IdentStart, IdentEnd, ForeStart, ForeEnd);
        Debug.WriteLine("Identification start: " + IdentStart.ToString);
        Debug.WriteLine("Identification end: " + IdentEnd.ToString);
        Debug.WriteLine("Forecast start: " + ForeStart.ToString);
        Debug.WriteLine("Forecast end: " + ForeEnd.ToString);
    End If;
End Sub UserProc;

After executing the example the model calculation period limits are displayed in the console window.

Fore.NET Example

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

Imports Prognoz.Platform.Interop.Ms;

Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
    MsKey: uinteger;
    Model: IMsModel;
    ModelPeriod: IMsModelPeriod;
    Calc: IMsMethodCalculation;
    Transform: IMsFormulaTransform;
    Coord: IMsFormulaTransformCoord;
    IdentStart, IdentEnd, ForeStart, ForeEnd: DateTime;
Begin
    mb := Params.Metabase;
    MsKey := mb.ItemById["CONT_MODEL"].Key;
    Model := mb.ItemByIdNamespace["MODEL", MsKey].Bind() As IMsModel;
    ModelPeriod := Model.Period;
    If Model.UseAutoPeriod Then
        Calc := Model.CreateCalculation() As IMsMethodCalculation;
        Transform := Model.Transform;
        Coord := Transform.CreateCoord(Transform.Outputs.Item[0]);
        ModelPeriod.AutoPeriodDates(Calc, Coord, Var IdentStart, Var IdentEnd, Var ForeStart, Var ForeEnd);
        System.Diagnostics.Debug.WriteLine("Identification start: " + IdentStart.ToString());
        System.Diagnostics.Debug.WriteLine("Identification end: " + IdentEnd.ToString());
        System.Diagnostics.Debug.WriteLine("Forecast start: " + ForeStart.ToString());
        System.Diagnostics.Debug.WriteLine("Forecast end: " + ForeEnd.ToString());
    End If;
End Sub;

After executing the example the model calculation period limits are displayed in the console window.

See also:

IMsModelPeriod