lazhen
2025-01-09 8afe90b633046db39042aada36b88193062f8cff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Quintiq file version 2.0
#parent: #root
Method CreateScenario2 (
  String datasetname,
  String scenarioname
) as stream[Void]
{
  Description: 'Setup test data for Scenario2'
  TextBody:
  [*
    
    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 to ease the checking of the csv file
        dto_periodparameter := DTO_PeriodParameter::Construct().StartOfPlanning( DateTime::Construct( 2022, 02, 01 ) );
        dto_periodspecification := DTO_PeriodSpecification::Construct().ID( "Monthly" ).NrOfHistoricalPeriod( 3 ).NrOfFuturePeriod( 2 );
        dto_currency := DTO_Currency::Construct().ID( "SEK" ).Name(" Swedish krona" ).Symbol( "kr" );
                                                                                                          
        run->UI_PeriodParameter::MenuEdit( macroplan2, dto_periodparameter.ToNVT() )
        ->| run->UI_PeriodSpecification::MenuEdit( macroplan2, dto_periodspecification.ID(), dto_periodspecification.ToNVT() ) 
        ->| run->UI_Currency::MenuNew( macroplan2, dto_currency.ToNVT() )
        ->| run->UI_Currency::MenuSetBase( macroplan2, dto_currency.ID() )
      }
    }   
                                                                     
    return Transaction::GetCurrentTask().OnFinish();
  *]
  InterfaceProperties { Accessibility: 'Module' }
}