| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod CanExportToDataManager ( | 
|   output String feedback_o, | 
|   LibDEF_DataBroker libDEF, | 
|   Boolean hassalesdemand, | 
|   LibDEF_SetMeta sdsetmeta, | 
|   String sdsetname, | 
|   Boolean ismpscdef, | 
|   Boolean hasmpsplan, | 
|   LibDEF_SetMeta mpssetmeta, | 
|   Boolean isnewdefset, | 
|   String mpsplansetname, | 
|   Boolean invalidexcelpath | 
| ) declarative remote as Boolean | 
| { | 
|   Description: 'Check whether we can export to data manager.' | 
|   TextBody: | 
|   [* | 
|     // Adhi Nov-27-2015 (created) | 
|      | 
|     feedback_o := ''; | 
|     /* If the checkbox is ticked but its respective chosen set is empty, show precondition message | 
|        Special case for manufacturing demand channel, where we can create new set(s) */ | 
|      | 
|     // Check export salesdemand / constrained forecast | 
|     if( hassalesdemand ) // no set type exists or when creating new, editor is empty | 
|     { | 
|       if( sdsetname = '' and isnull( sdsetmeta ) ) | 
|       { | 
|         feedback_o := Translations::MP_GlobalParameters_MP_CanExportToDataManager_InvalidExport(); | 
|       } | 
|       else if( exists( sdsetmeta, SetTypeMeta.SetMeta, setmeta, setmeta.Name() = sdsetname ) ) | 
|       { | 
|         feedback_o := Translations::MP_GlobalParameters_MP_CanExportToDataManager_SetNotUnique(); | 
|       } | 
|     } | 
|      | 
|     // Check export salesdemand / constrained forecast | 
|     if( feedback_o = '' and hasmpsplan ) | 
|     { | 
|       if( ismpscdef ) | 
|       { | 
|         isToggle := isnewdefset; | 
|         if( ( isToggle and mpsplansetname = '' ) or ( not isToggle and isnull( mpssetmeta ) ) ) | 
|         { | 
|           feedback_o := Translations::MP_GlobalParameters_MP_CanExportToDataManager_InvalidExport(); | 
|         } | 
|         else if( exists( mpssetmeta, SetTypeMeta.SetMeta, setmeta, setmeta.Name() = mpsplansetname ) ) | 
|         { | 
|           feedback_o := Translations::MP_GlobalParameters_MP_CanExportToDataManager_SetNotUnique(); | 
|         } | 
|       } | 
|       else | 
|       { | 
|         if( invalidexcelpath ) | 
|         { | 
|           feedback_o := Translations::MPSync_ImportProfile_ValidateInput_IsInvalidExcelPath(); | 
|         } | 
|       } | 
|     } | 
|      | 
|     return feedback_o = '' | 
|   *] | 
| } |