| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod CanSetAvailable ( | 
|   output String feedback_o, | 
|   ScenarioManager scenariomanager, | 
|   ScenarioNodes nodes, | 
|   Boolean isDatasetStoreEnabled | 
| ) remote as Boolean | 
| { | 
|   Description: 'Check the selected nodes if they can be set available' | 
|   TextBody: | 
|   [* | 
|     scenarios := ScenarioNode::GetScenarios( nodes ); | 
|     resourcemaanger := scenariomanager.ResourceManager_SM(); | 
|      | 
|     // This is to check for folders and selected nodes | 
|     invalidScenario := select( nodes, Elements, e, not e.CanSetAvailable( isDatasetStoreEnabled, feedback_o ) ); | 
|      | 
|     // This is to check all scenarios in the folder | 
|     if( isnull( invalidScenario ) ) | 
|     { | 
|       activeScenario := selectset( scenariomanager, ScenarioMP, scenario, true, scenario.IsLoaded() or scenario.IsLoadingInProgress() ); | 
|        | 
|       selectedInactiveScenario :=  selectset( scenarios, Elements, e, not e.IsLoaded() and not e.IsLoadingInProgress() ) | 
|      | 
|       isValid := not scenariomanager.IsSizingParameterOn() | 
|                  or ( activeScenario.Size() + selectedInactiveScenario.Size() ) <= resourcemaanger.MaxNrOfOnlineScenario(); | 
|        | 
|       if( not isValid ) | 
|       { | 
|         feedback_o:= Translations::Scenario_CanSetAvailable_ExceedTotalNrAllowedOnline( resourcemaanger.MaxNrOfOnlineScenario() ) | 
|       } | 
|     } | 
|      | 
|     return feedback_o = ''; | 
|   *] | 
| } |