IMsModelPeriod.GetPeriodSize

Syntax

GetPeriodSize(StartDate: DateTime; EndDate: DateTime; Level: DimCalendarLevel): Integer;

Parameters

StartDate. Date and time of the time span start.

EndDate. Date and time of the time span end.

Level. Period size.

Description

The ObtainPeriodSize method returns the number of periods in selected time span.

Example

Executing the example requires that the repository contains a modeling container with the CONT_MODEL identifier. This modeling container must include a problem with the OBJ_PROBLEM identifier.

Sub Main;

Var

MB: IMetabase;

MObj: IMetabaseObject;

Problem: IMsProblem;

Details: IMsForecastingProblem;

Period: IMsModelPeriod;

stDt, endDt: DateTime;

count: Integer;

Begin

MB := MetabaseClass.Active;

MObj := MB.ItemByIdNamespace("OBJ_PROBLEM", MB.ItemById("CONT_MODEL").Key).Bind;

Problem := MObj As IMsProblem;

Details := Problem.Details As IMsForecastingProblem;

Period := Details.Period;

stDt := Period.ForecastStartDate;

endDt := Period.ForecastEndDate;

count := Period.GetPeriodSize(stDt, endDt, DimCalendarLevel.Year);

Debug.WriteLine(The number of years in the problem forecasting period: + count.ToString);

End Sub Main;

After executing the example the number of years in the problem forecasting period is displayed in the console window.

See also:

IMsModelPeriod