IifLevel(
Calendar: IDimInstance;
El: Integer;
Level: DimCalendarLevel;
El1: Integer;
El2: Integer): Integer;
Calendar. Data of the calendar dictionary, by which calculation is executed.
El. Index of the element, relative to which calculation is executed.
Level. The level, on belonging to which the El element is checked.
El1. Index of the element returned if the El element is located on the Level level.
El2. Index of the element is returned if the El element is not located on the Level level.
The IifLevel method checks if the specified element belongs to the specified dictionary level.
If the El element belongs to the Level level, the method returns the index of the El1 element, otherwise it returns El2.
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 IifLevel(T: Variant): Integer;
Var
Cube: ICubeInstance;
CubeDest: ICubeInstanceDestination;
DimInsts: ICubeInstanceDimensions;
DimInst: IDimInstance;
i: Integer;
Result: Integer;
el1: 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
el1 := CalendarDimension.DownLevel(DimInst, t);
Result := CalendarDimension.IifLevel(DimInst, t, DimCalendarLevel.Quarter, el1, t);
// Return result
Return Result;
End Function IifLevel;
The result of using the relation in the formula of the calculated fact: the value for the elements of the quarterly frequency will be taken from the corresponding elements of the annual frequency.
See also: