Options

Download Multiple File Failed (Using Stream)

julkifli33julkifli33 Member Posts: 1,073
Hi All,
i want to generate file using stream
but if i use repeat , in order to generate multiple files, it will generate the last one only
any advise?

here is my code
procedure GenerateFile()
var
GJL : Record "Gen. Journal Line";
begin 
GJL.Reset;
if GJL.findset then
repeat
    DownloadFile(GJL."Document No.");
until GJL.next = 0;

end;


 procedure DownloadFile(DocNo:Code[20)
    var
        FileExportedName: Text;
        InStream: InStream;
        OutStream: OutStream;
        TempBlob: Codeunit "Temp Blob";
    begin
            FileExportedName := DocNo;
            TempBlob.CreateInStream(InStream);
            DownloadFromStream(InStream, '', '', '', FileExportedName);
    end;

Best Answer

  • Options
    JJMcJJMc Member Posts: 59
    Answer ✓
    Yo can also launch a window simple to accept something after each file, so the user needs to press, and you'll get each file.

Answers

  • Options
    ftorneroftornero Member Posts: 522
    Hello @julkifli33 ,

    Is a limitation of the web client, if ypou need to download more than a file you have to create a zip with them and download it.

    Take a look a this:
    https://github.com/microsoft/AL/issues/3575

    Regards
  • Options
    julkifli33julkifli33 Member Posts: 1,073
    @ftornero
    it doesnt work..
    seems like this one only for old version
  • Options
    julkifli33julkifli33 Member Posts: 1,073
    FileMgt.AddStreamToZipStream does not exist anymore.
    How can we manage ZIP files from Cloud?
  • Options
    ftorneroftornero Member Posts: 522
    Hello @julkifli33,

    use this
     Codeunit "Data Compression";
    

    Regards
  • Options
    JJMcJJMc Member Posts: 59
    Answer ✓
    Yo can also launch a window simple to accept something after each file, so the user needs to press, and you'll get each file.
  • Options
    julkifli33julkifli33 Member Posts: 1,073
    Hi @JJMc yeah it's work.
    even though it's a little bit weird but acceptable.
    Thank you so much.
Sign In or Register to comment.