Quintiq file version 2.0
|
#parent: #root
|
MethodOverride Copy (
|
ScenarioNode fromscenario,
|
String newassumption
|
)
|
{
|
Description: 'Copy more details from fromscenario'
|
TextBody:
|
[*
|
// Copy all assumptions over from the source scenario
|
source := fromscenario.astype( ScenarioMP );
|
|
traverse( source, Assumption, assumption )
|
{
|
assumption.Copy( this );
|
}
|
//delete the kpivalue that created during oncreate of scenario, and copy from source scenario
|
this.KPIValue( relflush );
|
traverse( source, KPIValue, kpi )
|
{
|
newkpi := kpi.DeepCopy( true, true ).astype( KPIValue ) ;
|
this.KPIValue( relinsert, &newkpi );
|
}
|
|
// Create new assumption for the new scenario
|
this.CreateNewAssumption( newassumption );
|
|
// Update last changed status of the new scenario
|
this.UpdateLastChanged();
|
|
datasetname := ScenarioManager::GetUniqueCompanyDatasetName( ScenarioManager::ScenarioMP() );
|
|
opt := DatasetCreateOptions::Construct( datasetname ).AsCopy( fromscenario.astype( ScenarioMP ).DatasetMDSID() )
|
.State( DatasetState::FromString( this.State() ) )
|
.Path( GlobalParameters_MP::GetDatasetFolder() );
|
|
MDSMacroPlan::Create( opt )->UpdateScenario( this )
|
*]
|
}
|