ICalendarDimensionClass.NineMonths

Syntax

NineMonths(Calendar: IDimInstance; El: Integer): Integer;

Parameters

Calendar. Data of the calendar dictionary, by which calculation is executed.

El. Index of the element, relative to which calculation is executed.

Description

The NineMonths method returns the index of the element corresponding to the Nine Months period, which includes the specified element.

Comments

For correct calculation the calendar dictionary must contain the Nine Months level. If the Months level is missing, the method throws an exception.

For example, if the calendar dictionary contains the Years, Nine Months, Days levels and the calculation is executed for:

Example

The example is the function that is used to calculate the relation in a standard cube.

To execute the example, add links to the Cubes and Dimensions system assemblies.

Function NineMonths(T: Variant): Integer;
Var
    Cube: ICubeInstance;
    CubeDest: ICubeInstanceDestination;
    DimInsts: ICubeInstanceDimensions;
    DimInst: IDimInstance;
    i: Integer;
    Result: Integer;
Begin
    // Get the current cube
    Cube := CubeClass.CurrentCube;
    CubeDest := Cube.Destinations.DefaultDestination;
    // Get calendar dimension
    DimInsts := CubeDest.Dimensions;
    For i := 0 To DimInsts.Count - 1 Do
        If (DimInsts.Item(i).Dimension Is ICalendarDimension) Then
            DimInst := DimInsts.Item(i);
        End If;
    End For;
    // Execute calculation
    If CalendarDimension.Level(DimInst, t) = DimCalendarLevel.Year Then
        Result := CalendarDimension.NineMonths(DimInst, t);
    Else
        Result := -1;
    End If;
    // Return result
    Return Result;
End Function NineMonths;

The result of using the relation in the formula of the calculated fact: the value for the element of the annual frequency will be taken from the first nine months period.

See also:

ICalendarDimensionClass