6 Jul 2022
Varying number of input files for work item
Here are some ways to handle the situation where you don't know in advance how many input files a given work item would need.
1) Zip up the input files and use that as a single input
This is what most people seem to be doing, but usually it's because the input files are already inside a zip 😄
In this case you only need a single input parameter for the activity and for convenience you can set its zip parameter to true so that it will be unzipped automatically on the Design Automation server - see localName, pathInZip, zip
2) Define multiple input parameters for the activity
You can define as many input parameters for activities as you want and you don't have to provide them all for the work items if you leave the parameter's required property false (which is the default value)
E.g. you could create input1 ... input10 for the activity but only provide input1 and input2 when starting the work item if you only need to work with 2 input files.
This might be preferable if you already have each file accessible on the cloud and you want to avoid having to download them all, zip them up, upload the zip file somewhere (or make it downloadable from the server) and then pass its URL to the work item.
3) Download the files on demand
In certain cases you might not even know all the files you need when you kick off the work item: maybe you only find out you need an additional file once you started processing the first one.
In that case you would either need to stop the work item and start a new one that also has that additional file as input, or download the additional file on demand
a) Use OnDemand input parameter
One way would be to expose a helper endpoint on your server that could be called to fetch a file for you - see HTTP GET/HEAD section in Communicate with servers from inside Design Automation
b) Download file from app bundle
Another option could be to write code inside the app bundle that downloads files from wherever they are - see Open Network in Preview
Do note that, at the time of writing this article, this functionality is still in preview.