Quintiq file version 2.0
#parent: #root
Method SelectScenario (
  Scenario scenario
) as Boolean id:Method_ApplicationLibMacroPlanner_SelectScenario
{
  #keys: '[11660.0.683114355]'
  Body:
  [*
    // Select the active MacroPlan based on passed in scenario
    // Set active MacroPlan to the application
    // ComponentMDS::Create( Application ) is not available in Editor -- still finding, if exist, all this code will be moved.
    status := false;
    
    if( not isnull( scenario ) )
    {
      editor := ExternalMDSEditor::Editor();
      allinfo := editor.ObjectInfos();
    
      mdsInfo := select ( allinfo, Elements, oinfo,
                          oinfo.MDSID().MDSKey() = scenario.DatasetMDSID()
                          or oinfo.Name() = scenario.DatasetName());
    
    
      if( not mdsInfo.IsLoaded() )
      {
        scenario.SetAvailable( '' );
      }
    
      status := this.SelectScenarioReadOnly( scenario );
    }
    
    return status;
  *]
}
