How to insert a "variable string" into "FILENAME" topic of "FILE IN" node?

Hello,

I'm working with a machine that uses different programms according to the production. Each programm has its own file and the machine says what programm is running thru an ".ini" file. I'm reading this .ini and getting the directory and filename of the actual programm running. Now i need to read the programm file so i can get the setup values. The filename and directory are always changing so i need it to be an "variable" string and insert it in the "FILE IN" node, but can't manage to do it.

I did this to get the names of directory and file then change it to variables.
image

variables:
image

now i need to make a complete path with the variables, like "C:\Users\user\Documents\projects\VARIABLE1\VARIABLE2" and insert it into the read file node:
image

Any help would be appreciated!

You can use a change node to concatenate the string and insert the globals using JSONata expression. Or do similar in a function node with Javascript. Then feed msg.filename into the file in node.

[{"id":"4d185d09.5d09a4","type":"inject","z":"8d22ae29.7df6d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":70,"y":2620,"wires":[["b18987ec.4d8fd"]]},{"id":"b18987ec.4d8fd","type":"change","z":"8d22ae29.7df6d","name":"","rules":[{"t":"set","p":"filename","pt":"msg","to":"\"C:\\\\Users\\\\user\\\\Documents\\\\projects\\\\\" & $globalContext(\"directory\") & \"\\\\\" & $globalContext(\"file\")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":210,"y":2660,"wires":[["fcb80581.9b311"]]},{"id":"fcb80581.9b311","type":"debug","z":"8d22ae29.7df6d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":506.33331298828125,"y":2570.333251953125,"wires":[]}]

Thank you very much!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.