IDimElementGroup.DimensionInstance

Fore Syntax

DimensionInstance: IDimInstance;

Fore.NET Syntax

DimensionInstance: Prognoz.Platform.Interop.Dimensions.IDimInstance;

Description

The DimensionInstance property allows to install a dictionary sample for the group of elements.

Comments

Use the property on copying the group of elements to bind the copied group to another dictionary.

Fore Example

Executing the sample requires two dictionaries with the Dim_1 and Dim_1_COPY identifies. For the Dim_1_COPY dictionary the groups of elements are set.

Add links to the Dimensions and Metabase system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    obj: IMetabaseObject;
    desc: IMetabaseObjectDescriptor;
    childs: IMetabaseObjectDescriptors;
    CInfo: IMetabaseObjectCopyInfo;
    group: IDimElementGroup;
    i: Integer;
Begin
    mb := MetabaseClass.Active;
    desc := mb.ItemById("Dim_1");
    childs := desc.Children;
    If childs.Count <> 0 Then
        For i := 0 To childs.Count - 1 Do
            desc := childs.Item(i);
            If desc.ClassId = 1029 Then
                CInfo := mb.CreateCopyInfo;
                CInfo.Source := mb.ItemById("Dim_1_COPY1").Children.Item(i);
                CInfo.Destination := desc;
                mb.CopyObject(CInfo);
                obj := CInfo.Destination.Edit;
                group := obj.Edit As IDimElementGroup;
                group.DimensionInstance := desc.Open(NullAs IDimInstance;
                (group As IMetabaseObject).Save;
                Break;
            End If;
        End For;
    End If;
End Sub UserProc;

After executing the example the first found group of elements is copied from the dictionary with the Dim_1_COPY identifier to the Dim_1 dictionary.

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;
    obj: IMetabaseObject;
    desc: IMetabaseObjectDescriptor;
    childs: IMetabaseObjectDescriptors;
    CInfo: IMetabaseObjectCopyInfo;
    group: IDimElementGroup;
    i: Integer;
Begin
    mb := Params.Metabase;
    desc := mb.ItemById["Dim_1"];
    childs := desc.Children;
    If childs.Count <> 0 Then
        For i := 0 To childs.Count - 1 Do
            desc := childs.Item[i];
            If desc.ClassId = 1029 Then
                CInfo := mb.CreateCopyInfo();
                CInfo.Source := mb.ItemById["Dim_1_COPY1"].Children.Item[i];
                CInfo.Destination := desc;
                mb.CopyObject(CInfo);
                obj := CInfo.Destination.Edit();
                group := obj.Edit() As IDimElementGroup;
                group.DimensionInstance := desc.Open(NullAs IDimInstance;
                (group As IMetabaseObject).Save();
                Break;
            End If;
        End For;
    End If;
End Sub;

See also:

IDimElementGroup