Quintiq file version 2.0
#parent: #root
Method DeselectScenario (
  internal[GUIComponent] component,
  MacroPlan activedatasetkind
) id:Method_ApplicationLibMacroPlanner_DeselectScenario
{
  #keys: '[11660.0.765423489]'
  Body:
  [*
    // Deselect a scenario in component level
    
    componentmds := null( ComponentMDS );
    if ( not isnull( component ) )
    {
      componentmds := ComponentMDS::CreateForLoadedMDSsOnly( component );
    }
    else
    {
      componentmds := ComponentMDS::CreateForLoadedMDSsOnly( Application );
    }
    
    mdsinstance := select( componentmds,
                           ComponentMDSKinds.ComponentMDSInstances,
                           m,
                           m.IsLoaded()
                           and m.MDSID().Equals( guard( activedatasetkind.MDSID(), Key::ZeroKey() ) ) );
    
    
    
    if ( not isnull( mdsinstance ) and not isnull( componentmds ) )
    {
      mdsinstance.ComponentMDSKind().DeselectAll();
      componentmds.Apply();
    }
  *]
}
