I have this bit of code:
[{"id":"1eae07ed.d651f8","type":"change","z":"a1911aa3.c45be8","g":"b924568e.8a90a8","name":"path","rules":[{"t":"set","p":"path","pt":"msg","to":"log_paths","tot":"global"},{"t":"set","p":"filename","pt":"msg","to":"reboot_logs.txt","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":960,"y":2240,"wires":[["799a0ae4.20f21c"]]},{"id":"799a0ae4.20f21c","type":"file","z":"a1911aa3.c45be8","g":"b924568e.8a90a8","name":"Log boot","filename":"","appendNewline":true,"createDir":false,"overwriteFile":"false","encoding":"none","x":1120,"y":2240,"wires":[[]]}]
So given the global
context is set why is the file being created in ~
as reboot_logs.txt
?
it should be msg.path
set to global.log_paths
.
Ok....
Studied.
This is correct - yes?
[{"id":"799a0ae4.20f21c","type":"file","z":"a1911aa3.c45be8","g":"b924568e.8a90a8","name":"Log boot","filename":"","appendNewline":true,"createDir":false,"overwriteFile":"false","encoding":"none","x":1150,"y":2240,"wires":[[]]},{"id":"26943207a7d686da","type":"function","z":"a1911aa3.c45be8","g":"b924568e.8a90a8","name":"Set path/file","func":"var path = global.get(\"log_paths\");\nmsg.filename = path + \"reboot_logs.txt\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":980,"y":2240,"wires":[["799a0ae4.20f21c"]]}]
So you can't use change
nodes where you set msg.filename
and msg.path
and they work any more?
I'm sure they used to.
Though it may explain a couple of rogue files I've found.
The FIle Out node has never used msg.path
to set the path. It only uses msg.filename
.
1 Like
Ok, thanks.
I'm a bigger idiot than I thought.
So the latter is correct? Just wanting to triple check.
Always remember to read the help
Not sure which 'latter' you are refering to at this point.
You can use the Change node to set any property to anything. You could use a Debug node to verify the properties are being set, rather than assume the node has stopped working.
But that's just it.
I was sure I did.
Somehow another node must/could have done it and I goofed when translating sending messages to this node.
I think I just cocked up big time.
system
Closed
28 December 2021 12:43
9
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.