Hello Node Red forum I need your help with a syntax problematic
v_pco="63488"; v_txt="Hallo"; test=["p[3].b[6].pco=63488", "p[3].b[6].txt=\"Hallo\"" ]; msg.payload=test;
if I send this variable with msg.payload=test; it works. However, I would like to use v_pco and v_txt as a separate variable. But here I have a problem with the quotation How must the syntax be structured so that the data is passed on correctly?
var v_pco="63488"; var v_txt="Hallo"; var test=[`p[3].b[6].pco=${v_pco}`, `p[3].b[6].txt="${v_txt}"`]; msg.payload=test; return msg;
Alternatively...
var v_pco="63488"; var v_txt="Hallo"; msg.payload= { pco: v_pco, txt: v_txt, pcoText: `p[3].b[6].pco=${v_pco}`, txtText: `p[3].b[6].txt="${v_txt}"` } return msg;
↑ This way, you can have text and values
THX it was the missing $
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.