File Upload for KNIME Server - Make Upload Optional?

I’m curious if it’s possible to make a File Upload choice on KNIME server optional?

E.g. I have the user upload several different files that undergo downstream manipulations, but there can be times when only a fraction of the inputs are needed that week for input.

All inputs are required fields via red asterisk notation. Can one of the file uploads be bypassed? and not made required?

1 Like

Hi @blenoir

Interesting use case!

I don’t think there is a direct way in the options to make a file upload *optional.
You could try a workaround and add a default path to an empty file so whenever there is no file selected it gets the empty file and then filters those files without content in a later point.

Best,
Martyna

1 Like

Hi @Martyna,

Thank you for the suggestion, would I approach that by using an Excel reader to an empty file, and push the file URL as a variable to File Upload?

On a side question, I noticed in Flow Variables for File Upload, there is a variable for ‘required’. Does this relate to the ‘required’ * for File Upload on WebPortal? If so, would pushing true/false work? or is it number based? or does ‘required’ mean something entirely different?

Hi,

yes, you could for example add a default file (doesn’t matter which format, excel should work too) and then check for the content - if empty ignore and take only those with something in it. I can imagine this could work, but i haven’t tested!

I find this really interesting with the “required” flow variable.
There is one trick to test what should be the input of a flow variable. You can give them a name by typing something into the text field you point to with the red arrow in your picture above and execute with some default values. Then you can check in the output table for the content of the variable with the given name.
Here it gives “true” by default so you could feed the flow variable also with an “false”.

Best,
Martyna

1 Like