I’ve created a report in Knime, it saves so much time and I wished I knew about Knime before.
Anyway, I have a report that writes to an Excel File, with the Excel Writer Node. I would like the name of the report to look something like this:
Daily Report 021218 am
Daily Report 021218 pm
I can already write the report name to “Daily Report”, it’s just adding the date, and the am/pm at the end that I would like to do.
Please can somebody offer me some advice.
You can generate current date and time using “Create Date&Time Range” node. There is an option in its configuration window below start and end points for this (“use execution date&time”). After creating the date, use a “String Manipulation” node to generate the path including file name, for example:
join("C:\\Daily Report ", string($Date&Time$)). Then use a “Table Row To Variable” node to generate a flow variable which contains the path and the file name created in the previous step. Now feed the flow variable to the “Excel Writer (XLS)” node and in the configuration window of the node, for the output location, beside the “browse…” button, you can see another button which is to use flow variables for that setting. Click on it and use the variable you’ve created as the path. Done!
current-date.knwf (17.9 KB)
Thank you for the quick reply.
I’ve tried your knwf file and it looks like it’s going to work, however I get an error about writing to the C drive “C:” is not writable.
I’ll let you know if I can sort it out, thanks again for your help so far
The path I used is an example. You can change the path and the file name as you wish (Be aware of using double backslashes “
\\” instead of one “
I’ve tried my main drive and an external drive, but no luck yet.
join("E:\TestFolder\ ", string($Date&Time$))
This is the error that I get:
WARN Excel Writer (XLS) 3:3 Relative paths are not allowed (‘E:TestFolder 2018-12-02.xlsx’), please enter an absolute path or a URL
Sussess, I got it to write to the main directory with this:
join("E:\Daily Report ", string($Date&Time$))
Sorry about all the messages, I got it to work!!! Thank you so much.
I went with this as my final output command:
join(“E:\Output\Daily Report “, string($Date&Time$),”.xlsx”)
The above has 2 backslashes, one after E: and one after Output, for some reason it only shows one backslash after each in the browser.
join(“E:\\Output\\Daily Report “, string($Date&Time$),”.xlsx”)
Yes, I told you about this:
I’m glad that your problem is solved now.
A post was split to a new topic: Integrate timestamp into filename