FreeDimensions: IMsDimensionFilterList;
FreeDimensions: Prognoz.Platform.Interop.Ms.IMsDimensionFilterList;
The FreeDimensions property returns collection of dimensions, by which multiple selection is enabled.
This property allows to set multiple selection in the output variable.
NOTE. Multiple selection in the output variable is available only in the determinate equation model.
If a dimension is contained in the FreeDimensions collection, output variable may have multiple selection by this dimension. Thus, calculation is performed in the cycle by all selected elements in the determinate equation.
Note:
If output variable selection contains non-fixed elements, and their dimensions are contained in the FreeDimensions collection, the IMsMethodCalculation.AllowEmptySelection property is set to False, result is loaded by all elements of corresponding dimensions. If the IMsMethodCalculation.AllowEmptySelection property is set to True, result is loaded only by selected elements.
If multiple selection is set in output variable dimensions, and these dimensions are contained in the FreeDimensions collection, result is loaded by all selection elements.
If input variable selection contains non-fixed elements, missing selection is taken from output variable.
If input variable selection is fully fixed, the corresponding value is taken.
Executing the example requires that the repository contains a modeling container with the MS identifier that contains a determinate equation model with the MODEL_FREEDIM identifier.
Add links to the Dimensions, Metabase, Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
MsKey: Integer;
Model: IMsModel;
Transform: IMsFormulaTransform;
Formula: IMsFormula;
FreeDimensions: IMsDimensionFilterList;
OutputVar: IMsFormulaTransformVariable;
Slice: IMsFormulaTransformSlice;
DimSel: IDimSelection;
Dim: IDimensionModel;
Filter: IMsDimensionFilter;
Begin
// Get current repository
mb := MetabaseClass.Active;
// Get modelling container key
MsKey := mb.GetObjectKeyById("MS");
// Get the model
Model := mb.ItemByIdNamespace("MODEL_FREEDIM", MsKey).Edit As IMsModel;
// Get model calculation parameters
Transform := Model.Transform;
// Get model calculation method
Formula := Transform.FormulaItem(0);
// Get list of dimensions, by which multiple selection is enabled
FreeDimensions := Formula.FreeDimensions;
// Get output variable
OutputVar := Transform.Outputs.Item(0);
// Set multiple selection by the first variable dimension
Slice := OutputVar.Slices.Item(0);
DimSel := Slice.Selection.Item(0);
DimSel.DeselectAll;
DimSel.SelectElement(1, False);
DimSel.SelectElement(2, False);
// Get this dimension and enable multiple selection in it
Dim := Slice.ParametrizedDimensions.Item(0).Dimension;
Filter := FreeDimensions.Add(Dim);
// Specify that dimension is non-fixed
Filter.Fixed := False;
// Save changes
(Model As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the model is calculation by multiple selection of the first dimension of output variable.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Ms;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
MsKey: uinteger;
Model: IMsModel;
Transform: IMsFormulaTransform;
Formula: IMsFormula;
FreeDimensions: IMsDimensionFilterList;
OutputVar: IMsFormulaTransformVariable;
Slice: IMsFormulaTransformSlice;
DimSel: IDimSelection;
Dim: IDimensionModel;
Filter: IMsDimensionFilter;
Begin
// Get current repository
mb := Params.Metabase;
// Get modelling container key
MsKey := mb.GetObjectKeyById("MS");
// Get the model
Model := mb.ItemByIdNamespace["MODEL_FREEDIM", MsKey].Edit() As IMsModel;
// Get model calculation parameters
Transform := Model.Transform;
// Get model calculation method
Formula := Transform.FormulaItem[0];
// Get list of dimensions, by which multiple selection is enabled
FreeDimensions := Formula.FreeDimensions;
// Get output variable
OutputVar := Transform.Outputs.Item[0];
// Set multiple selection by the first variable dimension
Slice := OutputVar.Slices.Item[0];
DimSel := Slice.Selection.Item[0];
DimSel.DeselectAll();
DimSel.SelectElement(1, False);
DimSel.SelectElement(2, False);
// Get this dimension and enable multiple selection in it
Dim := Slice.ParametrizedDimensions.Item[0].Dimension;
Filter := FreeDimensions.Add(Dim);
// Specify that dimension is non-fixed
Filter.Fixed := False;
// Save changes
(Model As IMetabaseObject).Save();
End Sub;
See also: