Replacing String Input with File Browser in Custom KNIME Node

Dear KNIME Community,

I am currently developing a custom KNIME node that requires users to input a file path. At present, this is implemented as a string input, necessitating users to manually type the file path. To enhance user experience, I would like to replace this with a file browser dialog, allowing users to navigate their file system and select the desired file interactively.

Could you please advise on the best approach to implement a file browser input within a custom KNIME node? Specifically, I am interested in:

  1. Integrating a file browser dialog: How can I implement a file selection dialog in my custom node’s configuration to enable users to browse and select files from their local system?

  2. Handling file paths: Once a file is selected, how should the file path be managed and passed within the node’s workflow?

  3. Validating file types: Is there a recommended method to restrict the file selection to specific file types (e.g., .obo files) and to display an error message if an invalid file type is selected?

I have explored existing nodes such as the “File Chooser Widget” and the “Local File Browser Configuration” node, but I am uncertain how to integrate similar functionality into a custom node. Any guidance, examples, or references to relevant documentation would be greatly appreciated.

Thank you for your assistance.

Best regards,

Mathis

Hi Mathis,

may I ask which API your are using to build your custom node?

Are you using Java or Python?

If you are using Python I can help you out:

You can use knime.extension.LocalPathParameter (see link to docs below):

https://knime-python.readthedocs.io/en/stable/extension-development.html

You can pass in a validator which should allow you to programmatically manage which files can be selected etc.

1 Like

Dear Martin,

Thank you very much for your prompt and helpful response. I sincerely appreciate your guidance on this project. I will study the documentation you’ve provided and attempt to integrate this functionality accordingly.

Should I encounter any further challenges or if this approach doesn’t fully address my requirements, I will return to this topic for further discussion.

Once again, thank you for your assistance.

Best regards,

Mathis