| Quintiq file version 2.0 | 
| #parent: #root | 
| Method OnMDSConstructedCustom #extension | 
| { | 
|   TextBody: | 
|   [* | 
|     // Add custom logic here, workaround for migrating scenariomanager.KPITrackerSetting to KpiGlobalParameter after the migration the KPITrackerSetting will be set to InActive | 
|     opt := DatasetFindOptions::Construct( ScenarioManager::GetDatasetName() ); | 
|     sm := MDSScenarioManager::Find( opt ); | 
|     sm->( scenariomanager ) | 
|     { | 
|       setting := scenariomanager.KPITrackerSetting_tobedeleted_2022_3(); | 
|       if ( not isnull( setting ) and not setting.IsInactive() ) | 
|       { | 
|         gp := this.GlobalParameter(); | 
|         | 
|         if ( isnull( gp ) ) | 
|         { | 
|           gp := KpiGlobalParameter::Create( this ); | 
|         } | 
|         if ( not gp.RecordEnabled() and gp.RecordStartTime().IsInfinite() ) | 
|         {  | 
|           gp.RecordEnabled( setting.IsAutoRecordKPI() ); | 
|           gp.RecordFrequency( setting.RecordFrequency() ); | 
|           gp.RecordStartTime( setting.StartOfRecording() ); | 
|            | 
|           traverse( this.MDSKpiTracker(), MDSObjectDaemons, daemon, | 
|                     daemon.Name() = "RecordDaemon" ) | 
|           { | 
|              | 
|             if ( setting.IsAutoRecordKPI() ) | 
|             { | 
|               daemon.LocalFrequency( gp.RecordFrequency() ) | 
|             }   | 
|             | 
|            daemon.LocalStartTime( gp.RecordStartTime() );   | 
|           } | 
|            | 
|            | 
|           cleanupdaemon := select( scenariomanager.MDSScenarioManager(), MDSObjectDaemons, d, d.Name() = "CleanUpKPISnapshot" ); | 
|            | 
|           traverse( this.MDSKpiTracker(), MDSObjectDaemons, daemon, | 
|                     daemon.Name() = "CleanUpDaemon" ) | 
|           { | 
|              | 
|             gp.CleanUpEnabled( true ); | 
|             gp.CleanUpFrequency( cleanupdaemon.LocalFrequency() ); | 
|             gp.CleanUpStartTime( cleanupdaemon.LocalStartTime() ); | 
|              | 
|             daemon.LocalFrequency( cleanupdaemon.LocalFrequency() ) | 
|             daemon.LocalStartTime( cleanupdaemon.LocalStartTime() );   | 
|           } | 
|         } | 
|       setting.IsInactive( true ); | 
|      }  | 
|     } | 
|   *] | 
| } |