IMsModelPeriod.AutoPeriodDates

Syntax

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

Parameters

Calculation. Settings that are necessary on model calculation.

Coord. Coordinate parameters in the variable, by which 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.

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 and 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
    // Get current repository
    mb := MetabaseClass.Active;
    // Get model
    MsKey := mb.ItemById("CONT_MODEL").Key;
    Model := mb.ItemByIdNamespace("MODEL", MsKey).Bind As IMsModel;
    // Get model periods
    ModelPeriod := Model.Transform.Period;
    // Set calculation period conditions
    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.

See also:

IMsModelPeriod