Quintiq file version 2.0
#parent: #root
Method WriteToDestinationFile (
  String exportpath,
  structured[BinaryValue] binaryvalues,
  structured[String] brokernames
) id:Method_DialogEDIExport_WriteToDestinationFile
{
  #keys: '[132680.0.795583]'
  Body:
  [*
    // Write the binary data of the respective 
    // file to its export destination
    i := 0;
    
    traverse( brokernames, Elements, brokername )
    {
      broker := select( Domain, EDIDefinitionManager.BrokerDefinitions, broker, broker.Name() = brokername );
      filename := broker.Destination().astype( EDIXLSLinkDefinition ).FileName() 
    
    
      binarydata := binaryvalues.Element( i ).AsBinaryData();
    
      filepath := exportpath  + "/" + filename + ".xlsx"
      Application.WriteBinaryFile( filepath, binarydata );
      i :=i+1;
    
    }
  *]
}
