Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method ImportXML ( 
 | 
  BinaryValue xml, 
 | 
  Scenario scenario 
 | 
) 
 | 
{ 
 | 
  Description: 'Import data from XML' 
 | 
  TextBody: 
 | 
  [* 
 | 
    // Import from XML 
 | 
    tempfilename := OS::TempFilename( OS::TempPath() ); 
 | 
    progress( 'Creating temporary xml', DateTime::ActualTime() ); 
 | 
    tempfile := OSFile::Construct( tempfilename ); 
 | 
    if( not isnull( tempfile ) ) 
 | 
    { 
 | 
      tempfile.ReadWriteMode( 'ReadWrite' ); 
 | 
      tempfile.Open(); 
 | 
      tempfile.WriteBinary( xml ); 
 | 
      tempfile.Flush(); 
 | 
      tempfile.Close(); 
 | 
     
 | 
      progress( 'Delete all data', DateTime::ActualTime() ); 
 | 
      this.DeleteAllData(); 
 | 
     
 | 
      progress( 'Propagation', DateTime::ActualTime() ); 
 | 
      // Recalculate the declarative attributes and relations after data deletion. 
 | 
      Transaction::Transaction().Propagate(); 
 | 
     
 | 
      info( 'Import from xml file', DateTime::ActualTime() ); 
 | 
      XMLIO::Import( tempfilename, this ); 
 | 
       
 | 
      progress( 'Removing xml file', DateTime::ActualTime() ); 
 | 
      OS::RemoveFile( tempfilename ); 
 | 
     
 | 
      //re-create supply chain view in case it is deleted (only happens in thin client) 
 | 
      this.CreateSupplyChainView( GlobalParameters_MP::GetUserName() ); 
 | 
    } 
 | 
     
 | 
    if( not isnull(  this.PeriodParameter_MP() ) ) 
 | 
    { 
 | 
      progress( 'Synchronizing periods', DateTime::ActualTime() ); 
 | 
      this.CalculateKPIScore( false ); 
 | 
    } 
 | 
     
 | 
    this.ScenarioName( scenario.Name() ); 
 | 
  *] 
 | 
} 
 |