| Quintiq file version 2.0 | 
| #parent: #root | 
| Method SelectScenario ( | 
|   Scenario scenario, | 
|   internal[GUIComponent] component | 
| ) id:Method_ApplicationLibMacroPlanner_SelectScenario_1 | 
| { | 
|   #keys: '[11660.0.107083107]' | 
|   Body: | 
|   [* | 
|     // Select the active macroplan based on passed in scenario | 
|     // Set active macroplan to the passed in component (Form) | 
|     // ComponentMDS::Create( Application ) is not available in Editor -- still finding, if exist, all this code will be moved. | 
|      | 
|     if( not isnull( scenario ) ) | 
|     { | 
|       editor := ExternalMDSEditor::Editor(); | 
|       allinfo := editor.ObjectInfos(); | 
|      | 
|       mdsInfo := select( allinfo, Elements, oinfo, | 
|                          not isnull( oinfo.MDSID() ) | 
|                          and oinfo.MDSID().MDSKey() = scenario.DatasetMDSID() | 
|                          or oinfo.Name() = scenario.DatasetName() ); | 
|      | 
|      | 
|       if( not isnull( mdsInfo ) and mdsInfo.IsLoaded() ) | 
|       { | 
|         scenario.SetAvailable( '' ); | 
|      | 
|         this.ComponentMDS_SelectInstance( component, scenario ); | 
|       } | 
|     } | 
|   *] | 
| } |