IDescStatsBox.AddVariableStubFixedSlice

Syntax

AddVariableStubFixedSlice(Stub: IVariableStub; VarDims: IDimSelectionSet);

Parameters

Stub. The variable, which descriptive statistics should be calculated.

VarDims. Element selection in additional dimension.

Description

The AddVariableStubFixedSlice method adds a variable to component and specifies selection in additional dimensions of the variable.

Comments

After the variable is added to the component, descriptive statistics are calculated for it.

This method is relevant only if the variable has additional dimensions. Selection by these dimensions is specified in the VarDims parameter. If the variable does not have additional dimensions, one can set the VarDims parameter to Null.

Example

Executing the example requires that the repository contains a form with the following:

Add links to the Cubes, Dimensions, Metabase, Ms system assemblies.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    MB: IMetabase;
    MS, Var1: IMetabaseObject;
    Dims: IMsVariableDimensions;
    Dim: IMsVariableDimension;
    DimInst: IDimInstance;
    SelectionFact: IDimSelectionSetFactory;
    DimSS: IDimSelectionSet;
    DimSel: IDimSelection;
Begin
    MB := MetabaseClass.Active;
    MS := MB.ItemById("CONT_MODEL").Bind;
    Var1 := MB.ItemByIdNamespace("X1", MS.Key).Bind;
    Dims := (Var1 As IMsVariable).Dimensions;
    //Create a new selection
    SelectionFact := New DimSelectionSetFactory.Create;
    DimSS := SelectionFact.CreateDimSelectionSet;
    For Each Dim In Dims Do
        //Select first elements by all additional dimensions
        DimInst := (Dim.Model As IMetabaseObject).Open(NullAs IDimInstance;
        DimSel := DimSS.Add(DimInst);
        DimSel.SelectElement(0False);
    End For;
    //Connect modeling container to the DescStatsBox component
    //and load modeling variable
    DescStatsBox1.ModelSpace := MS As IMsModelSpace;
    DescStatsBox1.AddVariableStubFixedSlice(Var1 As IVariableStub, DimSS);
End Sub Button1OnClick;

After executing the example the DescStatsBox1 component will be connected to the CONT_MODEL modeling container. The X1 modeling variable will be loaded to the list of component variables. First elements of the variable's additional dimensions are fixed on loading.

See also:

IDescStatsBox