In the deprecated Excel Reader node it was possible to create a variable with the file name and location. This doesn’t work in the node in 4.3.3. When I try to create a variable called SourceFile it is not visible as a variable in the downstream node (Java edit variable (simple)). The float-over text says that I am exporting the path as a variable
but it doesn’t show up.
Note that at this point I don’t want the path as a “File/folder variable”.
Hi @kuenzifr , as you can see in the grey drop down, it says “”, meaning that you don’t have any compatible variables that you can use. This basically refers to the variable type.
If I’m not mistaken, it’s expecting a variable of type Path, so you need to provide a Path variable. If you’ve built your file path via string, just convert it to path using the String To Path node
if I got it right variable you create with Excel Reader in version 4.3.3 is type path which is not visible in Java Edit Variable (simple) node. You can convert it to string using Path to String (Variable) node and then it will be visible to downstream nodes and available for manipulation.
You are correct. If I use a String to Path (Variable) node, it is converted back to something that the Java node can use.
I don’t think the Path Variable has been thought through very well. This adds a lot of complexity to something that should be quite simple. There is no indication in the help files of this change in behaviour, which adds frustration on top. I hope someone is getting a lot of benefit from it.
The aim was to read in an Excel file, modify it and then save it under a new name (old file with a date code added). With the 4.3.3 Excel nodes I must convert the string input (SourceFile) to a path so that the Excel Reader node can use it (SourceFile_location), then to modify the file name I turn it back into a string (SourceFile_location_location), then to use it in an Excel writer node I have to turn it back into a path variable (SourceFile_location_location_location). I’m starting to sound like an estate agent trying to sell a house near a shop and a school
Hello @kuenzifr ,
you are right the current situation is suboptimal. We have added several path manipulation functions to the Column Expression node that allow you to manipulate path cells. You can find a workflow with the different functions here.
We plan to add similar functionality to the Variable Expression node as well which should solve the problem with manipulating path variables. Until then you have to do the conversion as mentioned by Ivan.
For further information about the new path call and variable and how to work with it have a look at the KNIME File Handling Guide.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.