IMsAggregationGroup.Attribute

Syntax

Attribute: IMetaAttribute;

Description

The Attribute property determines an attribute of aggregation group.

Example

Executing the example requires that the repository contains a time series database with the OBJ_RUBRICATOR identifier. The modeling container of the time series database must contain a problem with the OBJ_PROBLEM identifier. COUNTRY is the custom attribute of database indicators that refers to the dictionary. D_COUNTRY is a group of elements of this dictionary.

Add links to the Cubes, Dimensions, Metabase, Ms, Rds system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    RKey, ContKey, DimKey: Integer;
    Obj: IMetabaseObject;
    Problem: IMsProblem;
    T: IMsTransformationProblem;
    CalcSettings: IMsProblemCalculationSettings;
    Calculation: IMsProblemCalculation;
    Rubricator: IRubricator;
    Atrs: IMetaAttributes;
    Atr: IMetaAttribute;
    AgrGroups: IMsAggregationGroups;
    AgrGroup: IMsAggregationGroup;
    Group: IDimElementGroup;
Begin
    MB := MetabaseClass.Active;
    RKey := MB.ItemById("OBJ_RUBRICATOR").Key;
    ContKey := MB.ItemByIdNamespace("MODELSPACE_TRANSFORMS", RKey).Key;
    Obj := MB.ItemByIdNamespace("OBJ_PROBLEM", ContKey).Edit;
    Problem := Obj As IMsProblem;
    T := New MsTransformationProblem.Create;
    Problem.Details := T;
    CalcSettings := Problem.CreateCalculationSettings;
    CalcSettings.FactIncluded := True;
    Obj.Save;
    Calculation := Problem.Calculate(CalcSettings);
    AgrGroups := Calculation.AggregationGroups;
    If AgrGroups.Count > 0 Then
        AgrGroups.Clear;
    End If;
    AgrGroup := AgrGroups.Add;
    Rubricator := MB.ItemById("OBJ_RUBRICATOR").Edit As IRubricator;
    Atrs := Rubricator.Facts.Attributes;
    Atr := Atrs.FindById("COUNTRY");
    AgrGroup.Attribute := Atr;
    DimKey := Atr.ValuesObject.Key;
    Group := MB.ItemByIdNamespace("D_COUNTRY", DimKey).Edit As IDimElementGroup;
    AgrGroup.ElementGroup := Group;
    AgrGroup.AttributeValue := 1;
    Calculation.Run;
End Sub;

After executing the example, the aggregation group is added for modelling problem, then the problem is calculated.

See also:

IMsAggregationGroup