IMetaAttribute.Group

Syntax

Group: IMetaAttributeGroup;

Description

The Group property determines an attribute group.

Comments

If a group is set for an attribute, the attribute is a group attribute and always optional to fill. A value of a group attribute changes for all time series included in a group.

If an attribute is included in a unique key, that is, IMetaAttribute.Primary = True, it cannot have a group.

Example

Executing the example requires a time series database with the FC_GROUPS identifier that contains COUNTRY and INDICATOR mandatory time series attributes. These attributes are links to a dictionary. The time series database must not contain a primary index. Add links to the Rds, Metabase, Dimensions, Cubes system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    Rub: IRubricator;
    Dic: IMetaDictionary;
    Meta_idxs: IMetaIndexes;
    Meta_idx: IMetaIndex;
    MetaAttrs: IMetaAttributes;
    AttCountry, AttIndicator: IMetaAttribute;
    Grp: IMetaAttributeGroup;
    Dim_sel_fact: DimSelectionSetFactory;
    GrpSel: IDimSelectionSet;
    Dim_inst: IDimInstance;
    Dim_sel: IDimSelection;
    DimAttInst: IDimAttributeInstance;
    Dim_Element: Integer;
    GrFilter: IMetaAttributeGroupFilter;
    Att: IMetaAttribute;
Begin
    mb := MetabaseClass.Active;
    Rub := mb.ItemById("FC_GROUPS").Bind As IRubricator;
// Get dictionary of the database time series
    Dic := (Rub.Facts As IMetabaseObject).Edit As IMetaDictionary;
// Create primary index
    Meta_idxs := Dic.Indexes;
    Meta_idx := Meta_idxs.Primary;
    MetaAttrs := Dic.Attributes;
    AttCountry := MetaAttrs.FindById("COUNTRY");
    AttIndicator := MetaAttrs.FindById("INDICATOR");
    If Meta_idx = Null Then
        Meta_idx := Meta_idxs.Add;
        Meta_idx.Attributes.Add(AttCountry);
        Meta_idx.Attributes.Add(AttIndicator);
        Meta_idx.Enabled := True;
        Meta_idx.Primary := True;
    End If;
// Add a group
    Grp := Dic.Groups.Add;
    Grp.Name := Relationship attributes between countries;
// Assign primary attribute of a group
    Grp.PrimaryAttributes := MetaAttrs.CreateSubset("COUNTRY", SubsetOperation.Select_);
// Assign free attribute of a group
    Grp.FreeAttributes := MetaAttrs.CreateSubset("INDICATOR", SubsetOperation.Select_);
// Form selection for free attribute INDICATOR
    Dim_sel_fact := New DimSelectionSetFactory.Create;
    GrpSel := Dim_sel_fact.CreateDimSelectionSet;
    Dim_inst := AttIndicator.ValuesObject.Open(NullAs IDimInstance;
    Dim_sel := GrpSel.Add(Dim_inst);
    DimAttInst := Dim_inst.Attributes.FindById("NAME");
    Dim_Element := DimAttInst.LookupValue("BCA");
    Dim_sel.SelectElement(Dim_Element, False);
    Dim_Element := DimAttInst.LookupValue("BDS");
    Dim_sel.SelectElement(Dim_Element, False);
    Dim_Element := DimAttInst.LookupValue("BCI");
    Dim_sel.SelectElement(Dim_Element, False);
    Grp.Filter.SetSelection(GrpSel);
// Form selection for primary attribute COUNTRY
    Dim_inst := AttCountry.ValuesObject.Open(NullAs IDimInstance; //COUNTRY
    Dim_sel := GrpSel.Add(Dim_inst);
    DimAttInst := Dim_inst.Attributes.FindById("NAME");
    Dim_Element := DimAttInst.LookupValue("Afghanistan");
    Dim_sel.SelectElement(Dim_Element, False);
    Dim_Element := DimAttInst.LookupValue("Albania");
    Dim_sel.SelectElement(Dim_Element, False);
    Dim_Element := DimAttInst.LookupValue("Brazil");
    Dim_sel.SelectElement(Dim_Element, False);
// Assign created selections in group filter
    GrFilter := Grp.Filter;
    If Not GrFilter.IsEmpty Then
        GrFilter.SetSelection(Null);
    End If;
    GrFilter.SetSelection(GrpSel);
// Create group attribute of factors
    Att := MetaAttrs.Add;
    Att.Name := Group;
    Att.Group := Grp;
// Save dictionary of the database time series
    (Dic As IMetabaseObject).Save;
End Sub UserProc;

After executing the example a group attribute of time series is created. An attribute is used for the series that:

See also:

IMetaAttribute