Mauri
22 June 2022 08:22
1
Hello Community
I want to generate a pdf in node red and want to enter the file name (and maybe the location) with variables. I heard that this could work with the msg.filename, but I couldn't find anything. can someone help me?
So I can generate a pdf but the file name is fixed.
Thanks for your help!
Mauri
remove the hard coded filename from the file node & in your function add something like...
// your code
const reportDate = new Date().toISOString().replace(/[TG]/g,'_').replace(/:/g,'-').substring(0,19);
const reportName = 'mydata'
msg.filename = `c/reports/report-${reportName}-${reportDate}.pdf`
return msg;
Mauri
22 June 2022 12:23
3
Thanks for your answer!
It works!
Mauri
22 June 2022 13:51
4
How can i program if there is no data the line should not be written?
For example this line:
If there is no data from "0x_0x_we_id", then the column should not be written...
If you post code/flow instead of pictures I can show you.
PS...
In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```
)
```
code goes here
```
See this post for more details - How to share code or flow json
PS2
If you dont reply to my comment I have no idea you have replied (there are 2 reply buttons, 1 at the bottom and one on a users last comment - this one notifies the user you are replying to them)
Mauri
24 June 2022 17:58
6
This is my flow:
Flow_Mauri.txt (50.3 KB)
The flow is in a -txt file, 'cause it's to big to share with the ```
I hope you can understand it...
Thanks
system
Closed
8 July 2022 17:58
7
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.