FilterDimension: IDimensionModel;
FilterDimension: Prognoz.Platform.Interop.Dimensions.IDimensionModel;
The FilterDimension property returns the dimension, in which multiple selection is enabled.
To fix this dimension, use the IMsDimensionFilter.Fixed property.
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, i: Integer;
Model: IMsModel;
Transform: IMsFormulaTransform;
Formula: IMsFormula;
FreeDimensions: IMsDimensionFilterList;
Filter: IMsDimensionFilter;
Dim: IDimensionModel;
Begin
// Get current repository
mb := MetabaseClass.Active;
// Get modelling container key
MsKey := mb.GetObjectKeyById("MS");
// Get model
Model := mb.ItemByIdNamespace("MODEL_FREEDIM", MsKey).Bind 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;
// If such dimensions exist, display information about them
If FreeDimensions.Count > 0 Then
For i := 0 To FreeDimensions.Count - 1 Do
Filter := FreeDimensions.Item(i);
Dim := Filter.FilterDimension;
Debug.WriteLine("Dimension name: " + (Dim As IMetabaseObject).Name);
If Filter.Param <> Null
Then Debug.WriteLine(" - parametric dimension, it is controlled by the parameter: " +
Filter.Param.Name);
Else Debug.WriteLine(" - non-parametric dimension");
End If;
If Filter.Fixed
Then Debug.WriteLine(" - fixed dimension");
Else Debug.WriteLine(" - non-fixed dimension");
End If;
End For;
End If;
End Sub UserProc;
After executing the example the console window displays information about dimensions of output variable, in which multiple selection is enabled.
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;
i: integer;
Filter: IMsDimensionFilter;
Dim: IDimensionModel;
Begin
// Get current repository
mb := Params.Metabase;
// Get modelling container key
MsKey := mb.GetObjectKeyById("MS");
// Get model
Model := mb.ItemByIdNamespace["MODEL_FREEDIM", MsKey].Bind() 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;
// If such dimensions exist, display information about them
If FreeDimensions.Count > 0 Then
For i := 0 To FreeDimensions.Count - 1 Do
Filter := FreeDimensions.Item[i];
Dim := Filter.FilterDimension;
System.Diagnostics.Debug.WriteLine("Dimension name: " + (Dim As IMetabaseObject).Name);
If Filter.Param <> Null
Then System.Diagnostics.Debug.WriteLine(" - parametric dimension, it is controlled by the parameter: " +
Filter.Param.Name);
Else System.Diagnostics.Debug.WriteLine(" - non-parametric dimension");
End If;
If Filter.Fixed
Then System.Diagnostics.Debug.WriteLine(" - fixed dimension");
Else System.Diagnostics.Debug.WriteLine(" - non-fixed dimension");
End If;
End For;
End If;
End Sub;
See also: