How to concatenate arrays

Hi,
How i can to concatenate 2 or 3 output(array 1D) of Modbus TCP client node in one array(1D) ?
example : Modbus1 => msg.payload => [ 0, 0, 76, 71, 13 ] and
Modbus2 => msg.payload => [ 5, 2, 5, 54, 21 ]
Modbus3 => msg.payload => [ 9, 9, 9, 9, 9 ]
i want to find in ouput msg.modbus [ 0, 0, 76, 71, 13, 5, 2, 5, 54, 21,9, 9, 9, 9, 9].

And how i can to change the output name of my modbustcpip, instead of having msg.payload i search to have msg.(Mytitle).

Thank you for your help.

Googling for
javascript concatenate arrays
gives
https://www.w3schools.com/jsref/jsref_concat_array.asp

Sorry, I don’t understand your second question

Thank you for your answer, but how can do it in my function if i have two output of my ModbusTcpip1 and ModbusTcpip1 than who have the same name(msg.payload)?
This is my secend question.

Do you mean the arrays are coming in on separate messages? If so then you can use the Join node in Manual mode to combine the two message payloads into a single message containing a key/value object and then you can combine the arrays.

Sans%20titre
that's what I want do
I'm sorry, I can't explain well because I'm a beginner on node-red
thank you Colin for your help (y) (y)

Most nodes will expect the “valuable” data to be in msg.payload so changing it to msg.somethingelse may cause you problems.

But you can use a change node to move data from one place to another.

If your work is Urgent, as per the title, its probably not the best time to use a tool you are a beginner with.

Thank you ukmoose for your answer
Sans%20titre
but the only way to concatenate the two arrays, it to change the name of the output of each mosbus to integrate them into function (how can I distinguish between the two output in function, they have the same name "msg.payload"?)
I hope you have understood my problem.
thank you

You could try the suggestion @Colin suggested above Urgent : Modbus tcp/ip array!

You can add a change node between the Mod bus to node and the array function node
and set e.g. msg.topic=1, the same for the ReadModBUSLabview > msg.topic=2

In your array function first check the msg.topic:

If (msg.topic === 1) {
  // ...
} else if (msg.topic === 2) {
  // ...
}

Are all these messages coming from one node or from different nodes?
Also do they have different topics?

This is exactly what I was looking for, I did not make the difference between the topic and the playload for each node , I think with this method I can do what I want

messages coming from different nodes in array forms and they have different topics.

Thank youu

In that case you can do what I originally suggested, using a Join node to give you a key/value object with all the payloads with individual keys.

Perfect my problem is solved, Thank you Colin,

hi,
i have the same problem but i can't solve it.
Can you help me?

This thread is two years old, please start a new one describing your problem. If you are trying to solve it using the marked solution above then explain what the problem is when you try that.