Operands: IMsFormulaTermList;
The Operands property returns the collection of terms that are used to set up aggregation expression.
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 method.
Add links to the Cubes, Metabase, Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
Rubr: IRubricator;
msDescr: IMetabaseObjectDescriptor;
Model: IMsModel;
Transform: IMsFormulaTransform;
Formula: IMsFormula;
Aggr: IMsCrossDimensionAggregationTransform;
i: Integer;
strsGen: IMsFormulaStringGenerator;
Begin
mb := MetabaseClass.Active;
Rubr := mb.ItemById("FC").Bind As IRubricator;
msDescr := Rubr.ModelSpace;
Model := mb.ItemByIdNamespace("MODEL_AGGR",msDescr.Key).Bind As IMsModel;
Transform := Model.Transform;
Formula := Transform.FormulaItem(0);
Aggr := Formula.Method As IMsCrossDimensionAggregationTransform;
strsGen := Formula.CreateStringGenerator;
strsGen.ShowFullVariableNames:= True;
Debug.WriteLine("Aggregation expression: " + strsGen.Execute);
Debug.WriteLine("Terms used in aggregation expression:");
For i := 0 To Aggr.Operands.Count- 1 Do
Debug.WriteLine(" " + Aggr.Operands.Item(0).TermToText);
End For;
Debug.WriteLine("Term containing aggregation results: " + Aggr.Result.TermToText);
End Sub;
After executing the example the console window displays information about the aggregation expression, terms used in the expression and the term that contains aggregation results. For example:
Aggregation expression: Countries in transition for publication|National Account[t] = Sum(BCA[t] / BCI[t] + NGDP[t])
Terms used in aggregation expression:
BCA[t]
BCI[t]
NGDP[t]
The term that contains aggregation results: Countries in transition for publication|National Account[t]
See also: