ICalcObject.FillSelSetFromParams

Syntax

FillSelSetFromParams(SelSet: IDimSelectionSet, StubKey: Integer): IDimSelectionSet;

Parameters

SelSet. Dimension selection.

StubKey. Data source key.

Description

The FillSelSetFromParams method passes the dimensions selection used as a calculation algorithm parameter to the parameters panel.

Example

Executing the example requires that the repository contains a calculation algorithm with the ALGORITHM identifier. At least one parameter is created in the list of algorithm parameters. The algorithm also contains a calculation block.

Add links to the Algo, Cubes, Dimensions, Metabase, Ms, Transform system assemblies. Add links to the assemblies required for working with calculation algorithms.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObjectDescriptor;
    Algo: ICalcObject;
    CalcAlgo: ICalcAlgorithm;
    CalcBlock: ICalcBlock;
    Stub: IVariableStub;
    SelSet: IDimSelectionSet;
    Param: IMsModelParam;
    CalcBlockParam: IMsModelParam;
    AlgParamTxt: String;
Begin
    MB := MetabaseClass.Active;
    // Get calculation algorithm
    MObj := MB.ItemById("ALGORITHM");
    Algo := CalcObjectFactory.CreateCalcObject(MObj, True);
    CalcAlgo := Algo As ICalcAlgorithm;
    // Get calculation block
    CalcBlock := CalcAlgo.Items.Item(0As ICalcBlock;
    // Get parameter and source
    Param := CalcAlgo.Params.Item(0);
    Stub := Param.LinkedStub;
    SelSet := CalcAlgo.SelControl.GetStubSel(Stub);
    // Set default value on parameters panel
    CalcAlgo.FillSelSetFromParams(SelSet, Stub.Key);
    CalcAlgo.SaveObject;
    // Check if algorithm parameter is used in calculation block
    AlgParamTxt := CalcBlock.FindParamUses(Param);
    If AlgParamTxt.IsEmpty Then
        Debug.WriteLine("Algorithm parameter is not used in calculation block and will be created");
        CalcBlockParam := CalcBlock.Params.Add;
        CalcBlockParam.Name := "Parameter from algorithm";
        CalcBlockParam.ParamType := TsParamType.Selection;
        CalcBlockParam.LinkedObject := Param.LinkedObject;
        CalcBlockParam.LinkedStub := Param.LinkedStub;
        CalcBlock.SaveObject;
    Else
        Debug.WriteLine(AlgParamTxt);
    End If;
End Sub UserProc;

After executing the example the source dimension selection of the parameter will be set on the parameters panel. If the algorithm parameter is not used in the calculation block, a new parameter will be created with settings from algorithm parameter. If the algorithm parameter is used, information about the place of use will be displayed.

See also:

ICalcObject