ArgumentCount: Integer;
The ArgumentCount property determines the number of arguments used in the MMin, MMax, MAvg functions.
Executing the example requires that the repository contains multidimensional calculation on DB server with the MDCalc_1 identifier.
Sub Main;
Var
MB: IMetabase;
MDInst: IMDCalculationInstance;
Dest: IMDCalculationDestinationInstance;
DestCoo: IMatrixCoord;
Slices: IMDCalculationSlicesInstance;
ElementKey: IMDCalculationFormulaElementKey;
Formulas: IMDCalculationFormulas;
Formula: IMDCalculationFormula;
FormulaExpression: IMDCalculationFormulaExpression;
FuncCallOperand: IMDCalculationFormulaFunctionCall;
i, j: Integer;
Begin
MB := MetabaseClass.Active;
MDInst := MB.ItemById("MDCalc_1").Open(Null) As IMDCalculationInstance;
Dest := MDInst.Destination;
DestCoo := Dest.NewCoord;
Slices := Dest.Slices;
For i := 0 To Slices.Count - 1 Do
DestCoo.Item(i) := 0;
End For;
ElementKey := Dest.CoordToKey(DestCoo);
ElementKey.FactIndex := 0;
Formulas := MDInst.ReadFormulas(ElementKey);
For i := 0 To Formulas.Count - 1 Do
Formula := Formulas.Item(i);
FormulaExpression := Formula.Expression;
For j := 0 To FormulaExpression.Count - 1 Do
If FormulaExpression.Item(j).Kind = MDCalculationFormulaOperandKind.FunctionCall Then
FuncCallOperand := FormulaExpression.Item(j) As IMDCalculationFormulaFunctionCall;
Debug.WriteLine("ArgumentCount:" + FuncCallOperand.ArgumentCount.ToString);
End If;
End For;
End For;
End Sub Main;
After executing the example all formulas are checked by the specified element of data consumer. If the MMin, MMax or MAvg functions are used in any formula, the number of arguments of applied function is displayed in the development environment console.
See also: