IMsDetermAggregationTransform.AggregationExpression

Syntax

AggregationExpression: String;

Description

The AggregationExpression property determines an expression for setting aggregation.

Comments

This property is used only for models that are based on attributes.

Example

Executing the example requires that the repository contains a time series database with the OBJ_RUBRICATOR identifier. COUNTRY and INDICATOR are custom database time series attributes that refer to dictionaries. NATIONAL_ACCOUNTS is a group of dictionary elements, to which the INDICATOR attribute refers.

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

Sub UserProc;
Var
    mb: IMetabase;
    CrInf: IMetabaseObjectCreateInfo;
    ModelCont: IMetabaseObjectDescriptor;
    obj: IMetabaseObject;
    Ruby: IRubricator;
    Transform: IMsFormulaTransform;
    Model: IMsModel;
    TransformVar: IMsFormulaTransformVariable;
    Coord: IMsFormulaTransformCoord;
    DetermAggregation: IMsDetermAggregationTransform;
    Slice: IMsFormulaTransformSlice;
    Selector: IMsFormulaTransformSelector;
    MetaAttrValList: IMsMetaAttributeValueList;
    MetaAttr: IMetaAttribute;
    MsMetaAttributeValue:IMsMetaAttributeValue;
    Formula: IMsFormula;
    DimKey: Integer;
    Group: IDimElementGroup;
Begin
    mb := MetabaseClass.Active;
    CrInf := Mb.CreateCreateInfo;
    CrInf.ClassId := MetabaseObjectClass.KE_CLASS_MSMODEL;
    CrInf.Name := "New_aggregation";
    Ruby := mb.ItemById("OBJ_RUBRICATOR").Bind As IRubricator;
    ModelCont := Ruby.ModelSpace;
    CrInf.Parent := ModelCont;
    CrInf.Permanent := True;
    Obj := Mb.CreateObject(CrInf).Edit;
    Model := Obj As IMsModel;
    Transform := Model.Transform;
    Transform.Rubricator:= Ruby;
    TransformVar := Transform.Outputs.Add(Null);
    Coord := Transform.CreateCoord(TransformVar);
    Slice := TransformVar.Slices.Add(Null);
    Slice.MetaAttributeValueList.Clear;
    MetaAttrValList := Slice.MetaAttributeValueList;
    MetaAttr := Ruby.Facts.Attributes.FindById("COUNTRY");
    MsMetaAttributeValue:= MetaAttrValList.Add(MetaAttr);
    MsMetaAttributeValue.Value:= 215;
    Selector := Transform.CreateSelector;
    Selector.Slice := Slice;
    Formula := Transform.Transform(Selector);
    Formula.Kind := MsFormulaKind.DetermAggregation;
    DetermAggregation :=Formula.Method As IMsDetermAggregationTransform;
    Formula.Level := DimCalendarLevel.Year;
    DetermAggregation.AggregationExpression:= "Panama";
    DetermAggregation.WeightsExpression:= "Albania";
    DetermAggregation.CompositionRelevanceExpression:= "Belize";
    DetermAggregation.Threshold:= 56 / 100;
    DetermAggregation.Level:= True;
    DetermAggregation.Rebase:= True;
    DetermAggregation.LevelRebaseDate:= DateTime.ComposeDay(199811);
    DetermAggregation.AgregationMethod:= MsAgregationMethodType.Sum;
    DetermAggregation.MissingData.Method:= MissingDataMethod.SpecifiedValue;
    DetermAggregation.MissingData.SpecifiedValue:= 1;
    MetaAttr := Ruby.Facts.Attributes.FindById("INDICATOR");
    DimKey := MetaAttr.ValuesObject.Key;
    Group := Mb.ItemByIdNamespace("NATIONAL_ACCOUNTS",DimKey).Edit As IDimElementGroup;
    DetermAggregation.AggregationGroup:= Group;
    obj.Save;
End Sub;

After executing the example a model is created in the modeling container of the time series database. This model is based on the attributes of time series database and calculates aggregation by the following expression: = Rebase(Level(Sum((Panama) * (Albania)) / Sum(Albania)), 01.01.1998) where Indicators in National Accounts.

See also:

IMsDetermAggregationTransform