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
29
30
31
32
33
34
35
36
37
38
39
40
Quintiq file version 2.0
#parent: #root
Method EnsureImportExportDataset (
  Boolean loadIfOffline_i,
  Boolean createIfNotExists_i
) as Boolean id:Method_LibCal_GlobalState_EnsureImportExportDataset
{
  #keys: '[131094.1.1070484139]'
  Body:
  [*
    // Make sure that an ImportExport-dataset exists for the currently selected planning-dataset.
    // (EnsureDataset modifies the name, if applicable)
    success := false;
    
    importExport := dhImportExport.Data();
    if( not isnull( importExport ) )
    {
      datasetName := importExport.GetDatasetName();
      datasetName := LibCal_ImportExportDataset::EnsureDataset( datasetName, loadIfOffline_i, createIfNotExists_i );
    
      // Select the ImportExport-datatset.
      this.SelectImportExportDatasetIfExists();
    
      if( isnull( LibCal_ImportExportDataset ) )
      {
        // Try again, that usually works...
        this.SelectImportExportDatasetIfExists();
    
        if( isnull( LibCal_ImportExportDataset ) and createIfNotExists_i )
        {
          LibCal_Util::Info( "LibCal_pnlImportButton.EnsureImportExportDataset() : dataset '" + datasetName + "' of datasetkind '" + LibCal_ImportExportDataset::DATASETKIND() + "' could not be selected." );
        }
      }
    
      success := not isnull( LibCal_ImportExportDataset );
    }
    
    return success;
  *]
}