admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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*/ );
  *]
}