| Quintiq file version 2.0 | 
| #root | 
| #parent: #DomainModel | 
| TypeSpecialization Scenario | 
| { | 
|   #keys: '2[11660.0.899700853][11660.0.899700850]' | 
|   Description: 'G' | 
|   OnCreate: | 
|   [* | 
|     //Create kpivalue object | 
|     this.CreateKPI(); | 
|     // Assign 'Default'strategy to SelectedStrategy relation for new Scenario objects | 
|     if( isnull(  this.SelectedStrategy() )  ) | 
|     { | 
|       strategy := select( this.ScenarioManager(), Strategy, strategy, strategy.Name() = Translations::MP_GlobalParameters_DefaultStrategyName() ); | 
|       if( not isnull( strategy ) ) | 
|       {  | 
|         this.SelectedStrategy( relset, strategy ); | 
|       } | 
|     } | 
|   *] | 
|   OnDelete: | 
|   [* | 
|     // Automaticaly Delete corresponding Dataset when a scenario object is deleted | 
|     editor := MDSEditor::Editor(); | 
|     objectInfos := MDSEditor::Editor().ObjectInfos(); | 
|      | 
|     dataset := select( objectInfos, Elements, o, o.MDSID().MDSKey() = this.DatasetMDSID() ); | 
|      | 
|     if( not isnull( dataset ) ) | 
|     { | 
|       if( this.IsLoaded() )     // Memory-only datset should only use Unload to delete | 
|       { | 
|         editor.UnloadMDS( dataset.MDSID() ); | 
|       } | 
|       if( dataset.IsStoredInDB())      // Dataset with storage should be unloaded first, then delete here | 
|       { | 
|         editor.DeleteMDS( dataset.MDSID() ); | 
|       } | 
|     } | 
|     Transaction::Transaction().DisableUndo(); | 
|   *] | 
|   Parent: ScenarioNode | 
|   StructuredName: 'Scenarios' | 
| } |