IDescStatsBox.AddVariableStubFixedSlice

Fore Syntax

AddVariableStubFixedSlice(Stub: IVariableStub; VarDims: IDimSelectionSet);

Fore.NET Syntax

AddVariableStubFixedSlice(Stub: Prognoz.Platform.Interop.Cubes.IVariableStub; VarDims: Prognoz.Platform.Interop.Dimensions.IDimSelectionSet);

Parameters

Stub. The variable, which descriptive statistics must 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

This method is relevant only if the variable has additional dimensions. The VarDims parameter is used to specify selection in these dimensions. If the variable does not have additional dimensions, the user can set the VarDims parameter to Null.

Fore Example

Executing the example requires a form, a button named Button1 on the form, and the DescStatsBox component named DescStatsBox1. The repository contains a modeling container with the CONT_MODEL identifier that includes a modeling variable with the X1 identifier. This variable contains additional dimensions.

    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 new selection
        SelectionFact := New DimSelectionSetFactory.Create;
        DimSS := SelectionFact.CreateDimSelectionSet;
        For Each Dim In Dims Do
            //Select the first elements in all the additional dimensions
            DimInst := (Dim.Model As IMetabaseObject).Open(NullAs IDimInstance;
            DimSel := DimSS.Add(DimInst);
            DimSel.SelectElement(0False);
        End For;
        //Link the modelling container to the DescStatsBox component
        //and load the modelling variable
        DescStatsBox1.ModelSpace := MS As IMsModelSpace;
        DescStatsBox1.AddVariableStubFixedSlice(Var1 As IVariableStub, DimSS);
    End Sub Button1OnClick;

On clicking the button the DescStatsBox1 component is connected to the modeling container named CONT_MODEL. The modeling variable named X1 is loaded to the list of component variables. First elements of the variable's additional dimensions are fixed on loading.

Fore.NET Example

Executing the example requires a .NET form, a button named Button1 on the form, and the DescStatsBox component named DescStatsBox1. The repository contains a modeling container with the CONT_MODEL identifier that includes a modeling variable with the X1 identifier. This variable contains additional dimensions.

Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Ms;
//...
    Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
    Var
        MB: IMetabase;
        MS, Var1: IMetabaseObject;
        Dims: IMsVariableDimensions;
        Dim: IMsVariableDimension;
        DimInst: IDimInstance;
        SelectionFact: IDimSelectionSetFactory;
        DimSS: IDimSelectionSet;
        DimSel: IDimSelection;
    Begin
        MB := Self.Metabase;
        MS := MB.ItemById["CONT_MODEL"].Bind();
        Var1 := MB.ItemByIdNamespace["X1", MS.Key].Bind();
        Dims := (Var1 As IMsVariable).Dimensions;
        //Create new selection
        SelectionFact := New DimSelectionSetFactory();
        DimSS := SelectionFact.CreateDimSelectionSet();
        For Each Dim In Dims Do
            //Select the first elements in all the additional dimensions
            DimInst := (Dim.Model As IMetabaseObject).Open(NullAs IDimInstance;
            DimSel := DimSS.Add(DimInst);
            DimSel.SelectElement(0False);
        End For;
        //Link the modelling container to the DescStatsBox component
        //and load the modelling variable
        DescStatsBoxNet1.CtrlBox.ModelSpace := MS As IMsModelSpace;
        DescStatsBoxNet1.CtrlBox.AddVariableStubFixedSlice(Var1 As IVariableStub, DimSS);
    End Sub;

On clicking the button the DescStatsBoxNet1 component is connected to the modeling container named CONT_MODEL. The modeling variable named X1 is loaded to the list of component variables. First elements of the variable's additional dimensions are fixed on loading.

See also:

IDescStatsBox