IMetaAttributeGroupsSet.Item

Fore Syntax

Item(Index: Integer): IMetaAttributeGroup;

Fore.NET Syntax

Item[Index: integer]: Prognoz.Platform.Interop.Rds.IMetaAttributeGroup;

Parameters

Index. Element index.

Description

The Item property returns a specified element of a collection.

Comments

Indexation of elements in the collection is continuous and starts with zero. The IMetaAttributeGroupsSet.Count property returns the number of elements in the collection.

Fore Example

Executing the example requires a time series database with the FC_GROUPS identifier that contains a group attribute. Add links to the Rds, Metabase, Cubes, Dimensions system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    Rub: IRubricator;
    Dic: IMetaDictionary;
    Meta_idx: IMetaIndex;
    Groups: IMetaAttributeGroups;
    i: Integer;
    Grp: IMetaAttributeGroup;
    Dim_sel_fact: DimSelectionSetFactory;
    GrpSel: IDimSelectionSet;
    Dim_inst: IDimInstance;
    Dim_sel: IDimSelection;
    GrFilter: IMetaAttributeGroupFilter;
    Att: IMetaAttribute;
Begin
    mb := MetabaseClass.Active;
    Rub := mb.ItemById("FC_GROUPS").Bind As IRubricator;
// Receive database  time series  dictionary
    Dic := (Rub.Facts As IMetabaseObject).Edit As IMetaDictionary;
// Receive primary index of the dictionary
    Meta_idx := Dic.Indexes.Primary;
    Debug.WriteLine(Primary index attributes:);
    For Each Att In Meta_idx.AttributesSet Do
        Debug.WriteLine(" - " + Att.Name);
    End For;
// Receive groups of dictionary attributes    
    Groups := Dic.Groups;
    For i := 0 To Groups.Count - 1 Do
        Grp := Groups.Item(i);
        Debug.WriteLine(Group ' + Grp.Name + ');
        Dim_sel_fact := New DimSelectionSetFactory.Create;
        GrpSel := Dim_sel_fact.CreateDimSelectionSet;
        Debug.WriteLine(  Primary attributes:);
        For Each Att In Grp.PrimaryAttributes Do
            Debug.WriteLine("   - " + Att.Name);
            Dim_inst := Att.ValuesObject.Open(NullAs IDimInstance;
            Dim_sel := GrpSel.Add(Dim_inst);
            GrFilter := Grp.Filter;
            Debug.Write(     filter: );
            Debug.WriteLine(GrFilter.LoadSelection(GrpSel).FindById(Dim_inst.Ident).ToString);
        End For;
        If Grp.IsPartiallyFree Then
            Debug.WriteLine(  Free attributes:);
            For Each Att In Grp.FreeAttributes Do
                Debug.WriteLine("   - " + Att.Name);
                Dim_inst := Att.ValuesObject.Open(NullAs IDimInstance;
                Dim_sel := GrpSel.Add(Dim_inst);
                GrFilter := Grp.Filter;
                Debug.Write(     filter: );
                Debug.WriteLine(GrFilter.LoadSelection(GrpSel).FindById(Dim_inst.Ident).ToString);
            End For;
        End If;
        
    End For;
End Sub UserProc;

After executing the example, information on the primary index and group attributes of the time series database is displayed in the console window.

Fore.NET Example

Executing the example requires a time series database with the FC_GROUPS identifier that contains a group attribute.

Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Rds;

Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
    Rub: IRubricator;
    Dic: IMetaDictionary;
    Meta_idx: IMetaIndex;
    Groups: IMetaAttributeGroups;
    i: Integer;
    Grp: IMetaAttributeGroup;
    Dim_sel_fact: DimSelectionSetFactory;
    GrpSel: IDimSelectionSet;
    Dim_inst: IDimInstance;
    Dim_sel: IDimSelection;
    GrFilter: IMetaAttributeGroupFilter;
    Att: IMetaAttribute;
Begin
    mb := Params.Metabase;
    Rub := mb.ItemById["FC_GROUPS"].Bind() As IRubricator;
// Receive database  time series  dictionary
    Dic := (Rub.Facts As IMetabaseObject).Edit() As IMetaDictionary;
// Receive primary index of the dictionary
    Meta_idx := Dic.Indexes.Primary;
    System.Diagnostics.Debug.WriteLine(Primary index attributes:);
    For Each Att In Meta_idx.AttributesSet Do
        System.Diagnostics.Debug.WriteLine(" - " + Att.Name);
    End For;
// Receive groups of dictionary attributes
    Groups := Dic.Groups;
    For i := 0 To Groups.Count - 1 Do
        Grp := Groups.Item[i];
        System.Diagnostics.Debug.WriteLine(Group ' + Grp.Name + ');
        Dim_sel_fact := New DimSelectionSetFactory.Create();
        GrpSel := Dim_sel_fact.CreateDimSelectionSet();
        System.Diagnostics.Debug.WriteLine(  Primary attributes:);
        For Each Att In Grp.PrimaryAttributes Do
            System.Diagnostics.Debug.WriteLine("   - " + Att.Name);
            Dim_inst := Att.ValuesObject.Open(NullAs IDimInstance;
            Dim_sel := GrpSel.Add(Dim_inst);
            GrFilter := Grp.Filter;
            System.Diagnostics.Debug.Write(     filter: );
            System.Diagnostics.Debug.WriteLine(GrFilter.LoadSelection(GrpSel).FindById(Dim_inst.Ident).ToString(""","False));
        End For;
        If Grp.IsPartiallyFree Then
            System.Diagnostics.Debug.WriteLine(  Free attributes:);
            For Each Att In Grp.FreeAttributes Do
                System.Diagnostics.Debug.WriteLine("   - " + Att.Name);
                Dim_inst := Att.ValuesObject.Open(NullAs IDimInstance;
                Dim_sel := GrpSel.Add(Dim_inst);
                GrFilter := Grp.Filter;
                System.Diagnostics.Debug.Write(     filter: );
                System.Diagnostics.Debug.WriteLine(GrFilter.LoadSelection(GrpSel).FindById(Dim_inst.Ident).ToString(""","False));
            End For;
        End If;
    End For;
End Sub;

After executing the example information on the primary index and group attributes of the time series database is displayed in the console window.

See also:

IMetaAttributeGroupsSet