Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method SynchronizeScenarioStatus 
 | 
{ 
 | 
  Description: 'Synchronize scenario status from knowledge table' 
 | 
  TextBody: 
 | 
  [* 
 | 
    // amy Aug-25-2011 (created) 
 | 
    traverse( this, ScenarioStatus, ss ) 
 | 
    { 
 | 
      ss.IsInKnowledgeTable( false ); 
 | 
    } 
 | 
     
 | 
    scenariostatusTable := ScenarioStatusTable::Table(); 
 | 
    traverse( scenariostatusTable, Rows, row ) 
 | 
    { 
 | 
      scenariostatus := select( this, ScenarioStatus, ss, ss.Name() = row.Name() ); 
 | 
      if( isnull( scenariostatus ) ) 
 | 
      { 
 | 
        scenariostatus := ScenarioStatus::Create( this, row.Name() ); 
 | 
      } 
 | 
     
 | 
      scenariostatus.IsInKnowledgeTable( true ); 
 | 
    } 
 | 
     
 | 
    feedback := ''; 
 | 
    // Check whether the row that is not in KT will be deleted 
 | 
    traverse( this, ScenarioStatus, ss, not ss.IsInKnowledgeTable() and ss.CanDelete( feedback ) ) 
 | 
    { 
 | 
      ss.Delete(); 
 | 
    } 
 | 
  *] 
 | 
} 
 |