ICubeDimensionFixEx.AssignSelection

Syntax

AssignSelection(Source: IDimSelection; DimElement: Integer);

Parameters

Source. Selection that must be set in fixed dimension.

DimElement. Index of the element that must be selected.

Description

The AssignSelection method changes selection in the fixed dimension according to the parameters to be passed.

Comments

If the "-1" value is passed as the value of the DimElement parameter, the Source selection will be set for fixed dimension. If the index of specific element is passed then the Source selection is reset, and only one element with the DimElement index is selected.

Example

Executing the example requires that the repository contains a virtual cube with the V_Cube identifier. A virtual cube and the first source cube have the Dim_P parametric dimension that must be fixed at specific values of dimension parameters. Parameters of this dimension are not connected with parameters of virtual cube.

Sub UserProc;
Var
    MB: IMetabase;
    VirtCub: IVirtualCube;
    Source: IVirtualCubeSource;
    ControlInfo: IMetabaseObjectControlInfo;
    DimObj: IMetabaseObject;
    Params: IMetabaseObjectParamValues;
    Dim: IDimInstance;
    Sel: IDimSelection;
    Fix: ICubeDimensionFix;
    FixEx: ICubeDimensionFixEx;
    ParamValue: Integer = 100;
Begin
    MB := MetabaseClass.Active;
    //Open cube for edit
    VirtCub := MB.ItemById("V_Cube").Edit As IVirtualCube;
    //Get cube source
    Source := VirtCub.Sources.Item(0);
    //Change value of the parameter in the nested objects parameters
    ControlInfo := (VirtCub As IMetabaseObject).Params.ControlInfo;
    ControlInfo.Item(0).Item(0).Expression.AsString := ParamValue.ToString;
    //Get parametric dimension of the source
    DimObj := Source.Cube.Dimensions.FindById("Dim_P"As IMetabaseObject;
    //Parameters for opening dimension instance
    Params := DimObj.Params.CreateEmptyValues;
    Params.Item(0).Value := ParamValue;
    Dim := DimObj.Open(Params) As IDimInstance;
    //Create a selection based on a new dimension instance
    Sel := Dim.CreateSelection;
    Sel.MultiSelect := True;
    Sel.SelectElement(0False);
    Sel.SelectElement(1False);
    Sel.SelectElement(2False);
    //Get dimension fixing parameters
    Fix := Source.FixInfo.FindByKey(DimObj.Key);
    FixEx := Fix As ICubeDimensionFixEx;
    //Update selection of fixed parametric dimension
    FixEx.AssignSelection(Sel, -1);
    Fix.Fixed := True;
    //Save cube
    (VirtCub As IMetabaseObject).Save;
End Sub UserProc;

On executing the example the selection of fixed parametric dimension in virtual cube are changed: first three elements in the dimension are selected. The dimension is opened with the specified parameter value. To keep functions of virtual cube, save parameter value in managing of nested object parameters.

See also:

ICubeDimensionFixEx