InternalKey: Integer;
InternalKey: uinteger;
The InternalKey property returns internal key of the scenario.
The scenario data is stored in the database by the internal key.
InternalKey is generated only at first access to the property, and its value does not coincide with the scenario key as the repository object.
Executing the example requires that the repository contains a modeling container with the CONT_MODEL identifier. It is also necessary to add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
ModelSpace: IMsModelSpace;
Tree: IMsScenarioTreeEntries;
Folder: IMsScenarioTreeFolder;
Scen: IMsScenarioTreeElement;
Scenario: IMsScenario;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemById("CONT_MODEL").Edit;
ModelSpace := MObj As IMsModelSpace;
Tree := ModelSpace.ScenarioTree;
Folder := Tree.AddFolder(Additional scenarios);
Scen := Folder.Contents.AddScenario;
Scen.Name := Scenario #1;
Scenario := Scen.Scenario;
Debug.WriteLine(Scenario.InternalKey);
MObj.Save;
End Sub UserProc;
After executing the example a new folder is added into the scenarios tree of modeling container. One scenario is created in this folder. The internal key of the created scenario is displayed in the console window.
Executing the example requires that the repository contains a modeling container with the CONT_MODEL identifier. It is also necessary to add links to the Metabase, Ms system assemblies.
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MObj: IMetabaseObject;
ModelSpace: IMsModelSpace;
Tree: IMsScenarioTreeEntries;
Folder: IMsScenarioTreeFolder;
Scen: IMsScenarioTreeElement;
Scenario: IMsScenario;
i: uinteger;
Begin
MB := Params.Metabase;
MObj := MB.ItemById["CONT_MODEL_24"].Edit();
ModelSpace := MObj As IMsModelSpace;
Tree := ModelSpace.ScenarioTree;
Folder := Tree.AddFolder(Additional scenarios);
Scen := Folder.Contents.AddScenario();
Scen.Name := Scenario #1;
Scenario := Scen.Scenario;
i := Scenario.InternalKey;
MObj.Save();
End Sub;
After executing the example a new folder is added into the scenarios tree of modeling container. One scenario is created in this folder. The internal key of the created scenario is saved in the "i" variable.
See also: