Quintiq file version 2.0
#parent: lstDatasetsWithoutScenario
Response OnClick (
  shadow[Dataset] selection
) id:Response_lstDatasetsWithoutScenario_MenuCreateScenario_OnClick
{
  #keys: '[107496.2.1836687713]'
  Body:
  [*
    // Create scenario
    dlg := construct( ScenarioManager_DialogCreateEditMPScenario );
    
    scenario := dlg.NewScenarioFromDataset( this, selection );
    
    // remove the shadow Dataset object if creation is successful,
    // so that it is no longer a candidate for scenario creation
    if( not isnull( scenario ) )
    {
      selection.Delete();
      
      //Set active scenario on form
      frm := Application.Frame().FindChildObject( 'ScenarioManager_FormScenario' );
      if( not isnull( frm ) )
      {
        ApplicationLibMacroPlanner.SelectScenario( scenario, frm );
      }  
    }
  *]
  CanBindMultiple: false
  DefinitionID => /lstDatasetsWithoutScenario/Responsedef_lstDatasetsWithoutScenario_Menu_OnClick
  Initiator: 'MenuCreateScenario'
}
