you handle it by the following steps:
- create a sub microflow which contains your file as a parameter, and add download activity with your file as input.
- create a nanoflow contains your files list.
- add a loop to iterate over your files list.
- add the previous sub microflow to the loop, and let the iterator file as input for the sub microflow.
you should have something like this in your nanoflow
Hi ,
I faced this issue before and I tried many things ,Then I found Zip Handling module ,Through this module you can add a list of documents to .zip file and the below is the marketplace link :
https://marketplace.mendix.com/link/component/108292
Please check the below example :
take a look at this i think it may help you
https://github.com/allardbrand/DownloadMultipleFiles
Hi ,
The following appstore widget will help you to download multiple files
https://marketplace.mendix.com/link/component/60747
and also the following forum answer will guide to achieive it
https://forum.mendix.com/link/questions/99278
For me neither worked. I created a simple JavaScript action that does the trick:
// This file was generated by Mendix Studio Pro.
//
// WARNING: Only the following code will be retained when actions are regenerated:
// - the import list
// - the code between BEGIN USER CODE and END USER CODE
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
import "mx-global";
import { Big } from "big.js";
// BEGIN EXTRA CODE
export function downloadFileWithDelay(fileDoc) {
if (fileDoc.get("HasContents")) {
// get file location on server
console.dir(fileDoc);
const url = "/file?guid=" + fileDoc.getGuid() + "&target=internal";
const name = fileDoc.get("Name");
const message = "file with url:" + url + " and name " + name;
console.debug("found " + message);
// create a dummy link and append to page.
// trigger click on link to download document
// remove link again
const a = document.createElement('a');
a.href = url;
a.target = '_parent';
// use a.download if available, it prevents plugins from opening
if ('download' in a) {
a.download = name;
// Add a to the doc for click to work.
(document.body || document.documentElement).appendChild(a);
if (a.click) {
console.debug("starting download " + message);
a.click(); // trigger a click to initiate the download
}
// delete the temporary link.
a.parentNode.removeChild(a);
}
}
}
// END EXTRA CODE
/**
* A JavaScript action which facilitates a multiple file download. It needs a FileDocument list as input parameter and downloads the files.
*
* The code creates a link for every file which needs to be downloaded, automatically clicks the linking and this initiates the download of the file in the browser. After downloading the link is removed again from the DOM. For Internet Explorer a delay of 500 ms is added as that is needed for it to work in IE.
* @param {MxObject[]} fileDocumentList
* @returns {Promise.<void>}
*/
export async function JS_MultipleFileDownload(fileDocumentList) {
// BEGIN USER CODE
// iterate over file list fed from Studio Pro
fileDocumentList.forEach(fileDoc => {
if (window.document.documentMode) {
// a timeout is necessary for IE, which will otherwise only download the first file.
setTimeout(() => {
downloadFileWithDelay(fileDoc);
}, 500);
} else {
downloadFileWithDelay(fileDoc);
}
})
// END USER CODE
}