Hi KNIME community,
I have a simple workflow to import a file. This file is CSV, but it has telephone numbers, possibly with leading zeros. When using the CSV Reader node, this column is automatically labelled as Integer or Double and the leading zeros disappear. Therefore, I want to use the File Reader node, as it allows me to choose the string format for all columns.
Now the files I need to import always have a date stamp and I don’t want to change the file name every time. Therefore, I created this:
The first node finds the file in the folder, using a wildcard where the date stamp is. Result:
The second node makes this into a Flow Variable:
The problem is that when I want to select the Flow Variable in the File Reader step, it doesn’t show up. (But I can find the file using the static approach.)
Funnily enough, when I use the CSV reader, the Flow Variable DOES show. I have no clue why.
Who can help me ‘find’ my Flow Variable? Yes, I’ve read other topics, but most of them are about CSV reader and not File Reader. Your help is highly appreciated!
Hi @mldendulk ,
guess you need to convert the variable to string using the /Path to String (Variable) node. The File Reader does not support the new path variable yet.
Amazing, thanks a lot Simon!
- Put Path to String (Variable) node in between the second (after creating the Flow Variable) and third (File Reader) node, or;
- Put Path to String node in between the first (List Files/Folders) and second (Table Row to Variable) node.
Again, thank you for pointing me to this node.
Edit: I needed to add the prefix “file:\” in front of Path in order to be able to get results from the File Reader node. I encountered the same error as in Problem with the File Reader Node when using workflow variables (again) - #2 by MH.
I ended up using:
- List Files/Folders
- Constant Value Column (for “file:\”)
- String Manipulation (for joining the two columns)
- Table Row to Variable
- Path to String (Variable)
- File Reader
Thanks for reporting and we’re really sorry! We’re having a look at it and also thanks a lot for posting your workaround!
you can also use the String to URI node to create a URI (e.g. file:/C:/temp/filestats.csv) from the string path which you can than pass in to the File Reader node. So your workflow would look like this:
We are sorry for the confusion with the new path type that was introduced with the new file handling framework. We haven’t converted all reader and writer nodes as of now but working on in. We are also working on a solution for the CSV Reader to read the telephone numbers as string.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.