Result: IMsFormulaTerm;
Result: Prognoz.Platform.Interop.Ms.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.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Ms;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
msDescr: IMetabaseObjectDescriptor;
Model: IMsModel;
Transform: IMsFormulaTransform;
Formula: IMsFormula;
Aggr: IMsCrossDimensionAggregationTransform;
i: Integer;
strsGen: IMsFormulaStringGenerator;
Begin
// Get current repository
mb := Params.Metabase;
// 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
System.Diagnostics.Debug.WriteLine("Aggregation expression: " + strsGen.Execute());
System.Diagnostics.Debug.WriteLine("Terms used in aggregation expression:");
System.Diagnostics.Debug.Indent();
For i := 0 To Aggr.Operands.Count - 1 Do
System.Diagnostics.Debug.WriteLine(Aggr.Operands.Item[0].TermToText());
End For;
System.Diagnostics.Debug.Unindent();
System.Diagnostics.Debug.WriteLine("Term corresponding to output variable: " + Aggr.Result.TermToText());
End Sub;
See also: