Quintiq file version 2.0
#parent: #root
Method DownloadExcelFile (BinaryValue binaryvalue_i, String brokername_i) id:Method_LibSOPImpExp_DialogExcelExport_DownloadExcelFile
{
  #keys: '[144528.1.247478635]'
  Body:
  [*
    // Download Excel file on client based on binary value of Excel generated from server
    // and using the broker to infer the Excel filename to create
    
    // Get the Excel filename to create
    broker := select( Domain, EDIDefinitionManager.BrokerDefinitions, broker, broker.Name() = brokername_i );
    filename := broker.Destination().astype( EDIXLSLinkDefinition ).FileName()
    
    // Binary value of the Excel generated from server
    binarydata := binaryvalue_i.AsBinaryData();
    
    filepath := filename + ".xlsx";
    Application.Download( filepath, binarydata );
  *]
}
