How to get value in txt file?

Hi everyone, I have issue that I want get data from txt file, but I not good Javascript, so I dont know how to get it,
Example I want get value " PH = 0 " Col1 and Col2 in 0: object

To concatenate strings to create " PH = 0 " you use the JavaScript + operator
e.g...

var string1 = "PH"; //TODO: get value from array element 0 col1
var string1 = "0"; //TODO: get value from array element 0 col2
msg.payload = string1 + " = " + string2;
return msg;

To populate string1 and string2 variables with the ACTUAL VALUES, use the copy path button (as described below) and add msg. to the beginning. e.g. var string1 = msg.payload[0].col1;


There’s a great page in the docs that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

BX00Cy7yHi

https://nodered.org/docs/user-guide/messages

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