Splitting and joining an array

Hi

This seems to be an easy one, but I fail :slight_smile:

I am reading a modbus register and get an array back:
grafik

I am only interested in parts [0], [3] in order to get back a number: 3579
I was thinking of a split and join node combination
Splitting is easy, I get 4 messages back:

grafik

But how can i join/concatenate [0] and [3] in order to get the value 3579 back?

tnx :slight_smile:

Are you certain that is what you want? Seems a bit odd!

Anyhow, since your data is already an array, just concatenate the elements of interest in a function of change node.

Function:

msg.payload = parseInt(msg.payload[0].toString() + msg.payload[3].toString())
return msg

thank you, this does the job!
Yes, the values of 0 at position [1] and [2] are strange indeed, but this is what i get back...

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