Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method CreateScenario2 ( 
 | 
  String datasetname, 
 | 
  String scenarioname 
 | 
) as stream[Void] 
 | 
{ 
 | 
  Description: 'Setup test data for Scenario2' 
 | 
  TextBody: 
 | 
  [* 
 | 
    resource1 := "resource1"; 
 | 
    resource3 := "resource3"; 
 | 
     
 | 
    run := this.Run(); 
 | 
    mp2 := MDSMacroPlan::Create( DatasetCreateOptions::Construct( datasetname ).State( DatasetState::MemoryOnly() ) 
 | 
                                                                               .Path( GlobalParameters_MP::GetDatasetFolder() ) ) 
 | 
    mp2->( macroplan2 ) 
 | 
    { 
 | 
      this->CreateScenarioAndLinkToMacroPlan( macroplan2, scenarioname )->( scenario2 ) 
 | 
      { 
 | 
        // Hardcode start of planning year to ease the checking of capacity and csv file 
 | 
        dto_periodparameter := DTO_PeriodParameter::Construct().StartOfPlanning( DateTime::Construct( 2022, 01, 01 ) ); 
 | 
        dto_periodspecification := DTO_PeriodSpecification::Construct().ID( "Monthly" ).NrOfHistoricalPeriod( 3 ).NrOfFuturePeriod( 2 ); 
 | 
        dto_resouce := DTO_Unit::Construct().CurrencyID( "EUR" ).UnitOfMeasurementName( "Ton" ).CapacityType( GlobalParameters_MP::GetCapacityTypeTime() ).EndDate( Date::MaxDate() ); 
 | 
                                                                                                           
 | 
        run->UI_PeriodParameter::MenuEdit( macroplan2, dto_periodparameter.ToNVT() ) 
 | 
        ->| run->UI_PeriodSpecification::MenuEdit( macroplan2, dto_periodspecification.ID(), dto_periodspecification.ToNVT() )  
 | 
        ->| run->UI_Unit::MenuNew( macroplan2, dto_resouce.ID( resource1 ).Name( resource1 ).ToNVT() ) 
 | 
        ->| run->UI_Unit::MenuNew( macroplan2, dto_resouce.ID( resource3 ).Name( resource3 ).ToNVT() )   
 | 
      } 
 | 
    }    
 | 
                                                                      
 | 
    return Transaction::GetCurrentTask().OnFinish(); 
 | 
  *] 
 | 
  InterfaceProperties { Accessibility: 'Module' } 
 | 
} 
 |