Selection: IDimSelectionSet;
The Selection property determines the object containing slice selection.
Executing the example requires a model with the NEW_NONLINREG identifier in the modeling container with the KONT_MODEL identifier. The model contains input variables with additional dimensions.
Add links to the Metabase,Ms, Dimensions system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
Model: IMsModel;
Slice: IMsFormulaTransformSlice;
TransVar: IMsFormulaTransformVariable;
i: Integer;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemByIdNamespace("NEW_NONLINREG", MB.ItemById("KONT_MODEL").Key).Edit;
Model := MObj As IMsModel;
TransVar := Model.Transform.Inputs.Item(0);
Slice := TransVar.Slices.Item(0);
For i := 0 To Slice.Selection.Count - 1 Do
Slice.Selection.Item(i).DeselectAll;
Slice.Selection.Item(i).SelectElement(0, True);
End For;
Debug.WriteLine(Slice.CalendarMode);
MObj.Save;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Dimensions;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MObj: IMetabaseObject;
Model: IMsModel;
Slice: IMsFormulaTransformSlice;
TransVar: IMsFormulaTransformVariable;
i: Integer;
Begin
MB := Params.Metabase;
MObj := MB.ItemByIdNamespace["OBJ86608", MB.ItemById["MS_DEFAULT"].Key].Edit();
Model := MObj As IMsModel;
TransVar := Model.Transform.Inputs.Item[0];
Slice := TransVar.Slices.Item[0];
For i := 0 To Slice.Selection.Count - 1 Do
Slice.Selection.Item[i].DeselectAll();
Slice.Selection.Item[i].SelectElement(0, True);
End For;
System.Diagnostics.Debug.WriteLine(Slice.CalendarMode);
MObj.Save();
End Sub;
After executing the example, the selection by all additional dimensions is changed for the first input variable with the NEW_NONLINREG identifier. The console displays method for calculation of calendar elements in variable slice.
See also: