Quintiq file version 2.0
#parent: #root
Method PTF_TestDuplicateScenario (
  output Real duration,
  output String response,
  String scenarioname,
  String newscenarioname
) as Boolean id:Method_LibPTF_pnlTestRunner_PTF_TestDuplicateScenario
{
  #keys: '[136682.0.314444051]'
  Body:
  [*
    issuccessful := false;
    
    scenario := select( ScenarioManager, ScenarioNode.astype( Scenario ), scenario, scenario.Name() = scenarioname );
    preconditionflag := not isnull(  scenario );
    
    if( preconditionflag )
    {
      startprecisionctr := OS::PrecisionCounter();
      dialog := construct( ScenarioManager_DialogCreateEditMPScenario );
      dialog.SetCopyData( scenario );
      dialog.EditorScenarioName().Text( newscenarioname );
      
      newscenario := dialog.CopyScenario( scenario,
                                          dialog.EditorScenarioName().Text(),
                                          dialog.EditorAssumption().Text(),
                                          dialog.EditorComment().Text(),
                                          dialog.RadioButtonGroupStorageState().BoundValue(),
                                          dialog.RadioButtonGroupMode().BoundValue() );
    
    
      SelectionScenario.Data( newscenario);
      duration   := this.PTF_GetDurationInMilisecond( startprecisionctr );
      response   := 'Duplicate Scenario' ;
      issuccessful := true;
    }
    else
    {
      response := 'PTF_TestCreateData: Precondition failed because < input value not correct >'; // Your precondition failed reason
    }
    
    return issuccessful;
  *]
}
