| Quintiq file version 2.0 | 
| #parent: #root | 
| Method Copy ( | 
|   String newscenarioname, | 
|   Scenario scenario | 
| ) as String | 
| { | 
|   Description: 'Create a copy of the selected scenario' | 
|   TextBody: | 
|   [* | 
|     // ying ying Mar-14-2014 (created) | 
|     macroplanmdsid := MDSID::Create( scenario.DatasetMDSID() ); | 
|     datasetname := ScenarioManager::GetUniqueCompanyDatasetName( ScenarioManager::ScenarioMP() ) | 
|      | 
|     params   := MDSParameters::Create(); | 
|     params.State( scenario.State() ); | 
|     editor := MDSEditor::Editor(); | 
|     editor.CopyMDS( macroplanmdsid, datasetname, params ) | 
|      | 
|     //in order to find the newly copied dataset | 
|     //Kernel::Kernel().PropagateAll(); | 
|     //Transaction::Transaction().Propagate(); | 
|     //Transaction::Transaction().PropagateAll(); | 
|      | 
|     Kernel::Kernel().Sleep( 500 ); | 
|      | 
|      | 
|     return datasetname; | 
|   *] | 
| } |