Hi, question from a new user:
I created a workflow to process a set of csv files (merge and reformat data). The input consist of 3 files which I select using 3 file reader nodes. say:
ABCD-data.txt
ABCD-otherinfo1.txt
ABCD-otherinfo2.txt
The output consists of a new data file and a short report. These are cretaed in a csv wiriter and a pdf writer node. I would like these nodes to automatically use the following output names and place the files in the same directory as the 3 inputfiles:
ABCD-reformatteddata.txt
ABCD-knime-report.pdf
Based on suggestions I found on the KNIME pages I tried 2 approaches:
1) assign the selected input file name to a variable in the reader node. But then I cannot manage to create a new variable out of this that can be used as the file name of the output.
2) read all 5 filenames from a text file and put them into variables. This seems to work OK for the outputfiles but the file reader nodes give all sorts of errors.
So help is much appreciated. Either on the approaches that I tried, or on better solutions !
thanks, Steven
Steven, it is not clear why approach 1 is not working for you.
I assume that after assigning variable you can transform it by String Manipulation (Variable) node.
Also take in account that file writers may not work with file name/path variable if you initially did not save file to specific path without using variable.
Hi,
thanks for the response.
I came across the file writer/reader issue and did take the solution into account.
Regarding the variable: I cant figure out how to access this variable, manipulate it and then feed a new variable into my file writer. For instance, I found a very useful node "URL to filepath (variable)" but my file reader won't connect to it (the input connector is an open red dot). How do I make that work ?
cheers,
Steven
see if this helps.
the first Table Creator node has the list of prefixes
the table row to variable loop start is going to iterate over them
the Node 2 Table Creator is the input files and input directory
The three string manipulation tied to the Table Creator creates the path. The prefix is now a flow variable coming from the loop start
The string to URI creates a URI for the file reader, the Table Row to Variable node converts this to a variable so you can use it to configure the file reader
The do some stuff is to do what you need, returning the pdf data and the reformatted data
The rest follow the same logic as for the input.
The final variable loop end is to close the interation, the flow variables from the writers are attached to this to make sure next iteration does not start until the writing has been finished.
Hi ,
thanks, the description looks promising, but I cannot open the workflow: it imports fine, but when I double click I only get an empty workflow page. What could be wrong ?
cheers, Steven
1 Like