Hi Michał,
maybe you could use the second option of the Add attachment help, available on the blue i icon. I haven't used it though.
SQL Query
Query may work in two modes:
1. When attachment's source are existing instances of atachments, query should return list of attachments' ID's from WFDataAttachmets table.
E.g. SELECT [ATT_ID] FROM [WFDataAttachmets] WHERE [ATT_Name] IN ('file.docx', 'file2.docx');
When there is need for attachments' names or descriptions to be changed query should return additional columns FileName, Description or Category
2. When attachments should be created in run-time, query MUST return columns FileName and Content, containing attachment's name and byte content. Query may also return column Description or Category, when there is need for attachment to contain description or category.
E.g. SELECT convert(image,'0x') AS Content, 'file1.txt' AS FileName
Afterwards you could download those attachment as a zip.
Alternative without a renamed filename:
1) Allow downloads in general
2) Activate it for the view
3) Select the instances and click on download.
I just noticed that the .zip file doesn't contain a folder for each workflow. I wonder what will happen if the attachments of multiple instances have the same name.
Best regards,
Daniel