IMsFindFormulaInfo.UseParamDims

Syntax

UseParamDims: Boolean;

Description

The UseParamDims property determines whether parametric dimensions in slices will be taken into account in search.

Comments

Available values:

Example

Executing the example requires that the repository contains a calculation algorithm with the ALGO identifier. A calculation block is created and set up in the calculation algorithm, a data source is a cube with the STD_CUBE identifier. The cube structure contains dimensions with the CITY and INDICATOR identifiers. A parameter is created in the calculation algorithm based on the specified cube and the INDICATOR dimension.

Add links to the Algo, Cubes, Dimensions, Metabase, and Ms system assemblies. Also, add links to the assemblies that are required to work with calculation algorithms.

Sub UserProc;
Var
    Mb: IMetabase;
    Alg: ICalcAlgorithm;
    FindInfo: IMsFindFormulaInfo;
    Factory: IDimSelectionSetFactory;
    DimSS: IDimSelectionSet;
Begin
    Mb := MetabaseClass.Active;
    Alg := CalcObjectFactory.CreateCalcObject(Mb.ItemById("ALGO"), TrueAs ICalcAlgorithm;
    Factory := New DimSelectionSetFactory.Create;
    DimSS := Factory.CreateDimSelectionSet;
    DimSS.Add(Mb.ItemById("CITY").Open(NullAs IDimInstance).SelectElement(0False);
    // Search conditions
    FindInfo := Alg.CreateFormulaFindInfo;
    FindInfo.Stub := Alg.Stubs.FindByKey(Mb.GetObjectKeyById("STD_CUBE"));
    FindInfo.Selection := DimSS;
    FindInfo.UseParamDims := True;
    FindInfo.ParametrizedDims.FindById("INDICATOR").ParamAttributes.Parameter := Alg.Params.Item(0);
    // Search and view results
    ShowAlgFindResults(Alg.FindFormulas(FindInfo));
End Sub UserProc;

Sub ShowAlgFindResults(Results: IAlgoFindFormulaResults);
Var
    Result: IAlgoFindFormulaResult;
    Block: IAlgoCalcBlockFindFormulaResult;
    Branch: IAlgoBranchCondFindFormulaResult;
    Expr: IMsBranchConditionExpression;
    i, c: Integer;
Begin
    c := Results.Count;
    Debug.WriteLine("Formulas found: " + c.ToString);
    For i := 0 To c - 1 Do
        Result := Results.Item(i);
        If Result Is IAlgoCalcBlockFindFormulaResult Then
            Block := Result As IAlgoCalcBlockFindFormulaResult;
            Debug.WriteLine("Block name: " + Block.CalcObject.Name);
            Debug.WriteLine("Formula key: " + Block.FormulaKey.ToString + " " + Block.ChainModel.Name);
        Elseif Result Is IAlgoBranchCondFindFormulaResult Then
            Branch := Result As IAlgoBranchCondFindFormulaResult;
            Debug.WriteLine("Branch: " + Branch.Branch.Name);
            Debug.WriteLine("Case: " + Branch.BranchCase.Name);
            If Branch.BranchCondition Is IMsBranchConditionExpression Then
                Expr := Branch.BranchCondition As IMsBranchConditionExpression;
                Debug.WriteLine("Condition: " + Branch.BranchCondition.Key.ToString + " " + Expr.Expression.AsString);
            End If;
        End If;
        Debug.WriteLine("-------");
    End For;
End Sub ShowAlgFindResults;

After executing the example, the formulas are searched that contain the terms based on dimension elements of the specified data source. The first element of the CITY dimension will be selected, the calculation algorithm parameter selection will be used for the INDICATOR dimension. Information about the found formulas will be displayed in the development environment console.

See also:

IMsFindFormulaInfo