Show contents 

Ms > Ms Assembly Interfaces > IMsModelPeriod > IMsModelPeriod.ForecastAutoEndDate

IMsModelPeriod.ForecastAutoEndDate

Fore Syntax

ForecastAutoEndDate(Calculation: IMsMethodCalculation; Coord: IMsFormulaTransformCoord): DateTime;;

Fore.NET Syntax

ForecastAutoEndDate[Calculation: Prognoz.Platform.Interop.Ms.IMsMethodCalculation; Coord: Prognoz.Platform.Interop.Ms.IMsFormulaTransformCoord]: System.DateTime;

Parameters

Calculation. Settings that are necessary on model calculation.

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

Description

The ForecastAutoEndDate property returns forecasting period end date if conditions are used for calculating of model calculation period limits.

Comments

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

For simultaneous getting of all model calculation period limits, use the IMsModelPeriod.AutoPeriodDates method.

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));
        IdentStart := ModelPeriod.IdentificationAutoStartDate(Calc, Coord);
        IdentEnd := ModelPeriod.IdentificationAutoEndDate(Calc, Coord);
        ForeStart := ModelPeriod.ForecastAutoStartDate(Calc, Coord);
        ForeEnd := ModelPeriod.ForecastAutoEndDate(Calc, Coord);
        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]);
        IdentStart := ModelPeriod.IdentificationAutoStartDate[Calc, Coord];
        IdentEnd := ModelPeriod.IdentificationAutoEndDate[Calc, Coord];
        ForeStart := ModelPeriod.ForecastAutoStartDate[Calc, Coord];
        ForeEnd := ModelPeriod.ForecastAutoEndDate[Calc, Coord];
        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