Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method SynchronizeDatasets (structured_MDSDefinition MDSdefs, MDSObjectInfos objectinfos) 
 | 
{ 
 | 
  Description: 'Synchronize datasets from the real model' 
 | 
  TextBody: 
 | 
  [* 
 | 
    mdsDefinition := select( MDSdefs, Elements, mdsdef, mdsdef.InstanceType().Name() = this.Name() ); 
 | 
     
 | 
    allDatasets := selectset( this, Dataset, e, true ) 
 | 
    activeDatasets := construct( DMF_Datasets ); 
 | 
     
 | 
    if( not isnull( mdsDefinition ) ) 
 | 
    { 
 | 
      traverse( objectinfos, Elements, e, 
 | 
                e.Kind() = mdsDefinition.Name() ) 
 | 
      { 
 | 
        activeDatasets.Add( DMF_Dataset::Create( this, e.MDSID().MDSKey(), e.Name() ) ); 
 | 
      } 
 | 
    } 
 | 
     
 | 
    // Only mark them as deleted, will commence delete after DatasetInConvertorVersion synchronization 
 | 
    // we delete them if they no longe have DatasetInConvertorVersion 
 | 
    markAsDeleted := allDatasets.Difference( activeDatasets ); 
 | 
    DMF_Dataset::MarkAsDeleted( activeDatasets, false /*isdelete*/ ); 
 | 
    DMF_Dataset::MarkAsDeleted( markAsDeleted, true /*isdelete*/ ); 
 | 
  *] 
 | 
} 
 |