CompositionRelevanceTerm: IMsFormulaTermInfo;
The CompositionRelevanceTerm property determines the parameters of the term, which sets comparison block to calculate aggregation relevance.
The property is outdated, use IMsCrossDimensionAggregationTransform.CompositionRelevanceExpression.
When this expression is set, the IMsCrossDimensionAggregationOptions.Threshold property value must be determined. If the sum of the CompositionRelevanceTerm values divided by the sum of all values is less then the IMsCrossDimensionAggregationOptions.Threshold value, the aggregation is not calculated.
Executing the example requires that the repository contains a time series database with the FC identifier. A modeling container of this database must include a model with the MODEL_AGGR identifier calculated using extended aggregation. COUNTRY and INDICATOR are database time series attributes that refer to a dictionary.
Sub Main;
Var
mb: IMetabase;
RubrDescr: IMetabaseObjectDescriptor;
Rubr: IRubricator;
msDescr: IMetabaseObjectDescriptor;
Model: IMsModel;
Transform: IMsFormulaTransform;
Formula: IMsFormula;
Aggr: IMsCrossDimensionAggregationTransform;
strsGen: IMsFormulaStringGenerator;
info: IMsFormulaTermInfo;
selFactory: IDimSelectionSetFactory;
SelSet: IDimSelectionSet;
Attributes: IMetaAttributes;
DictDescr: IMetabaseObjectDescriptor;
SliceInp: IMsFormulaTransformSlice;
Options: IMsCrossDimensionAggregationOptions;
Begin
mb := MetabaseClass.Active;
RubrDescr := mb.ItemById("FC");
Rubr := RubrDescr.Bind As IRubricator;
msDescr := Rubr.ModelSpace;
Model := mb.ItemByIdNamespace("MODEL_AGGR", msDescr.Key).Edit As IMsModel;
Transform := Model.Transform;
Formula := Transform.FormulaItem(0);
Aggr := Formula.Method As IMsCrossDimensionAggregationTransform;
Aggr.AgregationMethod := MsAgregationMethodType.WeightedAverage;
selFactory := New DimSelectionSetFactory.Create;
SelSet := selFactory.CreateDimSelectionSet;
Attributes := Rubr.Facts.Attributes;
DictDescr := Attributes.FindById("COUNTRY").ValuesObject;
SelSet.Add(DictDescr.Open(Null) As IDimInstance);
SelSet.Item(0).DeselectAll;
DictDescr := Attributes.FindById("INDICATOR").ValuesObject;
SelSet.Add(DictDescr.Open(Null) As IDimInstance);
SelSet.Item(1).DeselectAll;
SelSet.Item(1).SelectElement(1, False);
info := Transform.CreateTermInfo;
SliceInp := Transform.Inputs.Add(RubrDescr.Bind As IVariableStub).Slices.Add(SelSet);
info.Slice := SliceInp;
Aggr.WeightsTerm := info;
Options := Aggr.Options;
Options.Threshold := 20;
Aggr.CompositionRelevanceTerm := info;
strsGen := Formula.CreateStringGenerator;
strsGen.ShowFullVariableNames := True;
Debug.WriteLine("Aggregation expression: " + strsGen.Exeslicee);
(Model As IMetabaseObject).Save;
End Sub Main;
After executing the example the following model parameters will be changed:
Aggregation method is weighted average.
Aggregation weights are set.
Threshold and comparison block for the aggregation relevance determination are set.
The expression, by which aggregation is calculated, is displayed in the console window.
Aggregation expression: Angolaa|BCA[t] = Sum((BCA[t]) * (BCI[t])) / Sum(BCI[t])
See also: