| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod FindCreate ( | 
|   UserImportProfile owner_i, | 
|   String username_i, | 
|   MacroPlan macroPlan | 
| ) as ImportProfileExcel | 
| { | 
|   TextBody: | 
|   [* | 
|     // 1. Find current import object | 
|     importObj := select( owner_i, ImportProfileExcel, e, e.SessionID() = username_i ); | 
|      | 
|     // 2. Create import object | 
|     if( isnull( importObj ) ) | 
|     { | 
|       importObj := owner_i.ImportProfileExcel( relnew, SessionID := username_i ); | 
|     } | 
|      | 
|     // Always set idle (in case re-using import object for the user) | 
|     importObj.Status( LibSOPImpExp_ImportExportBase::Status_Idle() ); | 
|     importObj.MacroPlanDatasetName( macroPlan.DatasetName() ); | 
|      | 
|     // 3. Create data sources | 
|     LibSOPImpExp_DataSource::CreateDataSources( owner_i.MPSync(), importObj, false ); | 
|     return importObj; | 
|   *] | 
| } |