ICalendarDimension.CompareLevels

Fore Syntax

CompareLevels(Level1: DimCalendarLevel; Level2: DimCalendarLevel): CalendarCompareLevelsResult;

Fore.NET Syntax

CompareLevels(Level1:  Prognoz.Platform.Interop.Dimensions.DimCalendarLevel;Level2:  Prognoz.Platform.Interop.Dimensions.DimCalendarLevel):  Prognoz.Platform.Interop.Dimensions.CalendarCompareLevelsResult;

Parameters

Level1, Level2. Calendar levels.

Description

The CompareLevels method is used to determine result of comparing of calendar levels.

Comments

To get index of the specified calendar level, use the ICalendarDimension.CalendarLevelIndex property.

Fore Example

Executing the example requires a calendar dictionary with the D_CALENDAR identifier with set up calendar levels.

Add links to the Metabase and Dimensions system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    mbObj: IMetabaseObject;
    Cal : ICalendarDimension;
    Res : CalendarCompareLevelsResult;
    StrRes: String;
Begin
    mb := MetabaseClass.Active;
    mbObj :=mb.ItemById("D_CALENDAR").Bind;
    Cal := mbObj As ICalendarDimension;
    Res := Cal.CompareLevels(DimCalendarLevel.Quarter,DimCalendarLevel.Month);
    StrRes:=(Res As Variant) As String;
    Select Case StrRes
            Case "-2": Debug.WriteLine("Non-applicable");
            Case "-1": Debug.WriteLine("Less");
            Case "0": Debug.WriteLine("Equal");
            Case "1": Debug.WriteLine("Greater");
    End Select;
End Sub UserProc;

After executing the example the console window displays result of comparing of the specified calendar levels.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore Example.

Imports Prognoz.Platform.Interop.Dimensions;

Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
    mbObj: IMetabaseObject;
    Cal : ICalendarDimension;
    Res : CalendarCompareLevelsResult;
    StrRes: String;
Begin
    mb := Params.Metabase;
    mbObj :=mb.ItemById["D_CALENDAR"].Bind();
    Cal := mbObj As ICalendarDimension;
    Res := Cal.CompareLevels(DimCalendarLevel.dclQuarter,DimCalendarLevel.dclMonth);
    StrRes:=(Res As object) As String;
    Select Case StrRes
            Case "-2": System.Diagnostics.Debug.WriteLine("Non-applicable");
            Case "-1": System.Diagnostics.Debug.WriteLine("Less");
            Case "0": System.Diagnostics.Debug.WriteLine("Equal");
            Case "1": System.Diagnostics.Debug.WriteLine("Greater");
    End Select;
End Sub;

See also:

ICalendarDimension