Result: IMsFormulaTerm;
The Result property returns the term corresponding to output variable.
To get terms used for aggregation expression creation, use the IMsCrossDimensionAggregationTransform.Options property.
Executing the example requires that the repository contains a modeling container with the MS identifier that contains an extended aggregation model with the MODEL_AGGREGATION identifier.
Add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
msDescr: IMetabaseObjectDescriptor;
Model: IMsModel;
Transform: IMsFormulaTransform;
Formula: IMsFormula;
Aggr: IMsCrossDimensionAggregationTransform;
i: Integer;
strsGen: IMsFormulaStringGenerator;
Begin
// Get current repository
mb := MetabaseClass.Active;
// Get model
msDescr := mb.ItemById("MS");
Model := mb.ItemByIdNamespace("MODEL_AGGREGATION", msDescr.Key).Bind As IMsModel;
// Get model parameters
Transform := Model.Transform;
Formula := Transform.FormulaItem(0);
Aggr := Formula.Method As IMsCrossDimensionAggregationTransform;
strsGen := Formula.CreateStringGenerator;
strsGen.ShowFullVariableNames := True;
// Display information about model in the console window
Debug.WriteLine("Aggregation expression: " + strsGen.Execute);
Debug.WriteLine("Terms used in aggregation expression:");
Debug.Indent;
For i := 0 To Aggr.Operands.Count - 1 Do
Debug.WriteLine(Aggr.Operands.Item(0).TermToText);
End For;
Debug.Unindent;
Debug.WriteLine("Term corresponding to output variable: " + Aggr.Result.TermToText);
End Sub UserProc;
After executing the example the console window displays information about aggregation expression, about terms used in the expression and the term corresponding to output variable.
See also: