| Quintiq file version 2.0 | 
| #parent: #root | 
| Method O_OnExportStatusChanged () derived id:Method_DialogExcelExport_O_OnExportStatusChanged | 
| { | 
|   #keys: '[144528.1.240694106]' | 
|   BaseType: 'Method_LibSOPImpExp_DialogExcelExport_O_OnExportStatusChanged' | 
|   Body: | 
|   [* | 
|     // TO OVERRIDE. On changed of export status | 
|     // Can be use to download Excel files to client and/or close export dialog | 
|     if( status = LibSOPImpExp_ImportExportBase::Status_Done() ) | 
|     { | 
|       // Retrieve the export result from server | 
|       exportExcel := Form.O_GetAppExportObject().astype( ExportExcel ); | 
|        | 
|       // If only 1 Excel, download to client as it is | 
|       if( exportExcel.LibSOPImpExp_ExportExcelFile( relsize ) = 1 ) | 
|       { | 
|         file := exportExcel.LibSOPImpExp_ExportExcelFile( relget ).Element( 0 ); | 
|         Form.DownloadExcelFile( file.BinaryContent(), file.BrokerName() );  | 
|       } | 
|       else // If more than 1 Excel, zip it and download | 
|       { | 
|         json := JSON::Array(); | 
|         traverse( Form.O_GetAppExportObject(), astype( ExportExcel ).LibSOPImpExp_ExportExcelFile, file ) | 
|         { | 
|           fileJson := Form.FormatJSONForPackAsZip( file.BinaryContent(), file.BrokerName() ); | 
|           json.Add( fileJson ); | 
|         } | 
|          | 
|         Application.DownloadArchive( 'MP_Excels_' + DateTime::Now().Format( 'YMMD' ) + '.zip', json.Build() );  | 
|       } | 
|        | 
|       Form.Close(); | 
|     } | 
|   *] | 
| } |