ForecastAutoEndDate(Calculation: IMsMethodCalculation; Coord: IMsFormulaTransformCoord): DateTime;;
Calculation. Settings that are necessary on model calculation.
Coord. Coordinate parameters in the variable by which the calculation is executed.
The ForecastAutoEndDate property returns forecasting period end date if conditions are used for calculating of model calculation period limits.
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.
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 the 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));
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.
See also: