IMDCalculationFormulaFunctionCall.ArgumentCount

Syntax

ArgumentCount: Integer;

Description

The ArgumentCount property determines the number of arguments used in the MMin, MMax, MAvg functions.

Example

Executing the example requires that the repository contains multidimensional calculation on database server with the MDCalc_1 identifier.

Sub UserProc;
Var
    MB: IMetabase;
    MDInst: IMDCalculationInstance;
    Dest: IMDCalculationDestinationInstance;
    DestCoord: 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(NullAs IMDCalculationInstance;
    Dest := MDInst.Destination;
    DestCoord := Dest.NewCoord;
    Slices := Dest.Slices;
    For i := 0 To Slices.Count - 1 Do
        DestCoord.Item(i) := 0;
    End For;
    ElementKey := Dest.CoordToKey(DestCoord);
    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 UserProc;

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:

IMDCalculationFormulaFunctionCall