Get a local file path and relative path of the same folder

Hi @FrankColumbo , if the file you are creating is always relative to the workflow data area, you can find the workflow data folder absolute path from the Extract Context Properties node. This returns a set of contextual flow variables. One of these is the
context.workflow.absolute-path which is a String containing the absolute path to your workflow. The data area will then be this plus “/data” and you can concatenate your random folder name on to that.

The attached shows two ways of returning this as a String (using Variable Expressions, or String Manipulation (Variable) nodes )

EDIT:

An alternative method borrows from this post:


This converts the KNIME path into an absolute file location.

I have a component that I wrote a back in December 2022, based I think, on @qqilihq’s above solution

The attached flow contains the above options
FORUM - get different file paths.knwf (45.9 KB)

3 Likes