How to use msg.payload in INFLUXDB V2.4 query

Hello,
How to introduce the msg.payload variable in an influxDB V2.4 query. I want to put it in range(start: ).
</
msg.query=['from(bucket: "Temp")',
' |> range(start:"msg.payload")',
' |> filter(fn: (r) => r["_measurement"] == "Temperature 1")',
].join('\n');
return message;
/>

You can use a Template node (not ui_template) to create the query with the payload value embedded.

[Edit] Note that the query does not need to be on multiple lines, it can all be in one simple string.

Thank you Colin,
Have you an exemple please.

An example of what?
Did you read the help text for the Template node?

here is how i made the query, what i want is to use msg.payload as variable.

[{"id":"f77dfd0998d3cc46","type":"function","z":"1abeef9a268f3612","name":"","func":"//var var01=msg.payload;\nmsg.query='from(bucket: \"Temp\") |> range(start:-5h) |> filter(fn: (r) => r[\"_measurement\"] == \"Temperature 1\")';\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":260,"y":120,"wires":[["652b68907d4f05fb","a6332a1590c698ff"]]}]

It is much easier using a Template node as I suggested.

Thank you i try it

Just for completeness, if you ever do need to do stuff like this in a function node then the neatest way is to use the template literal syntax. So something like

msg.query = `from(bucket: "Temp") |> range(start:${msg.payload}) |> filter(fn: (r) => r["_measurement"] == "Temperature 1")`
return msg;

I tried that and it works.

var var01=msg.payload;
msg.query='from(bucket: "Temp")'+
' |> range(start:-'+var01+')'+
' |> filter(fn: (r) => r["_measurement"] == "Temperature 1")';

return msg;

Thank you for help

That is not what I suggested, and it would have been even easier in a Template node containing:
from(bucket: "Temp") |> range(start: {{payload}}) |> filter(fn: (r) => r["_measurement"] == "Temperature 1")
That is exactly what the Template node is for.