Combining values from an Array into a single word

What error? Please be specific.

What version of node-red are you using? How did you import (step-by-step)

OK everyone
I will try to work form here on own. No need to troll - in fact no time troll as this is already 10 PM here.

Thanks anyway

The payload you pasted above has a property "value" which is an array of 8 javascript objects.

msg.payload.value[0].value.value = 219
msg.payload.value[1].value.value = 299
msg.payload.value[2].value.value = {"0":-1,"1":-1,"2":-1,"3":-1}
msg.payload.value[3].value.value = 12336
msg.payload.value[4].value.value = false
msg.payload.value[5].value.value = false
msg.payload.value[6].value.value = true
msg.payload.value[7].value.value = {"0":0,"1":0,"2":0,"3":5}

Note that Node-red sees msg.payload.value[2 and 7].value.value as objects not arrays.

So you want to replace msg.payload.value[2].value.value with "-1-1-1-1"?
And msg.payload.value[2].value.value with "0005" ?
Is it always value[2] and value[7]?

Here is a flow to do the above, but I feel sure it can't be what you really need. I am not familiar with Modbus and it's data structure.

[{"id":"03010988047a67e4","type":"inject","z":"dc102a70652e7fb1","name":"Sample data","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"payload\":1722599750410,\"payloadType\":\"read\",\"value\":[{\"value\":{\"dataType\":\"Int16\",\"arrayType\":\"Scalar\",\"value\":291},\"statusCode\":{\"value\":0},\"sourceTimestamp\":\"2024-08-02T11:55:51.528Z\",\"sourcePicoseconds\":424000000,\"serverTimestamp\":\"2024-08-02T11:55:51.528Z\",\"serverPicoseconds\":420000000},{\"value\":{\"dataType\":\"Int16\",\"arrayType\":\"Scalar\",\"value\":299},\"statusCode\":{\"value\":0},\"sourceTimestamp\":\"2024-08-02T11:55:51.552Z\",\"sourcePicoseconds\":403000000,\"serverTimestamp\":\"2024-08-02T11:55:51.552Z\",\"serverPicoseconds\":399000000},{\"value\":{\"dataType\":\"Int16\",\"arrayType\":\"Array\",\"value\":{\"0\":-1,\"1\":-1,\"2\":-1,\"3\":-1}},\"statusCode\":{\"value\":0},\"sourceTimestamp\":\"2024-08-02T11:55:52.104Z\",\"sourcePicoseconds\":80000000,\"serverTimestamp\":\"2024-08-02T11:55:52.104Z\",\"serverPicoseconds\":76000000},{\"value\":{\"dataType\":\"Int16\",\"arrayType\":\"Scalar\",\"value\":12336},\"statusCode\":{\"value\":0},\"sourceTimestamp\":\"2024-08-02T11:55:52.127Z\",\"sourcePicoseconds\":857000000,\"serverTimestamp\":\"2024-08-02T11:55:52.127Z\",\"serverPicoseconds\":852000000},{\"value\":{\"dataType\":\"Boolean\",\"arrayType\":\"Scalar\",\"value\":false},\"statusCode\":{\"value\":0},\"sourceTimestamp\":\"2024-08-02T11:55:52.132Z\",\"sourcePicoseconds\":646000000,\"serverTimestamp\":\"2024-08-02T11:55:52.132Z\",\"serverPicoseconds\":643000000},{\"value\":{\"dataType\":\"Boolean\",\"arrayType\":\"Scalar\",\"value\":false},\"statusCode\":{\"value\":0},\"sourceTimestamp\":\"2024-08-02T11:55:52.136Z\",\"sourcePicoseconds\":758000000,\"serverTimestamp\":\"2024-08-02T11:55:52.136Z\",\"serverPicoseconds\":755000000},{\"value\":{\"dataType\":\"Boolean\",\"arrayType\":\"Scalar\",\"value\":true},\"statusCode\":{\"value\":0},\"sourceTimestamp\":\"2024-08-02T11:55:52.141Z\",\"sourcePicoseconds\":229000000,\"serverTimestamp\":\"2024-08-02T11:55:52.141Z\",\"serverPicoseconds\":225000000},{\"value\":{\"dataType\":\"Int16\",\"arrayType\":\"Array\",\"value\":{\"0\":0,\"1\":0,\"2\":0,\"3\":5}},\"statusCode\":{\"value\":0},\"sourceTimestamp\":\"2024-08-02T11:55:52.685Z\",\"sourcePicoseconds\":159000000,\"serverTimestamp\":\"2024-08-02T11:55:52.685Z\",\"serverPicoseconds\":156000000}],\"nodetype\":\"read\",\"injectType\":\"read\",\"addressSpaceItems\":[{\"name\":\"TempChan2\",\"nodeId\":\"ns=0;i=50343\",\"datatypeName\":\"\"},{\"nodeId\":\"ns=0;i=50349\"},{\"nodeId\":\"ns=0;i=50601\"},{\"nodeId\":\"ns=0;i=50640\"},{\"nodeId\":\"ns=0;i=50722\"},{\"nodeId\":\"ns=0;i=50723\"},{\"nodeId\":\"ns=0;i=50724\"},{\"nodeId\":\"ns=0;i=50547\"}],\"manualInject\":true,\"readtype\":\"VariableValue\",\"attributeId\":13,\"justValue\":true}","payloadType":"json","x":150,"y":60,"wires":[["4e1b29fbaf4f77a4","18849ef309e63841"]]},{"id":"4e1b29fbaf4f77a4","type":"function","z":"dc102a70652e7fb1","name":"Combine data in [2] and [7]","func":"function combine (object) {\n    let combined = \"\"\n    for (let key in object) {\n        combined += object[key]\n    }\n    return combined\n}\nmsg.payload.value[2].value.value = combine(msg.payload.value[2].value.value)\nmsg.payload.value[7].value.value = combine(msg.payload.value[7].value.value)\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":120,"wires":[["e3e9d77778a278a4"]]},{"id":"e3e9d77778a278a4","type":"debug","z":"dc102a70652e7fb1","name":"Output data","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":610,"y":120,"wires":[]},{"id":"18849ef309e63841","type":"debug","z":"dc102a70652e7fb1","name":"Input data","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":600,"y":60,"wires":[]}]

Thanks a lot jbudd.

Very kind and understanding.

I think, I was not able to state the problem clearly.
Look at this:
msg.payload.value[7].value.value = {"0":0,"1":0,"2":0,"3":5}
This means msg.payload.value[7].value.valueis an array with 4 objects.

What I need to do get value from msg.payload.value[7].value.value /object 1 which is 0,
= {"0":0,"1":0,"2":0,"3":5}
get value from msg.payload.value[7].value.value /object 2 which is 0,
get value from msg.payload.value[7].value.value /object 3 which is 0,
get value from msg.payload.value[7].value.value /object 5 which is 5,

then put these values 0005 in a variable (integer)

Another point I would like to mention:
to read object 1 of msg.payload.value[7].value.value, I am using: payload.value[7].value.value[0]

to read object 2 of msg.payload.value[7].value.value, I am using: payload.value[7].value.value[1]

to read object 3 of msg.payload.value[7].value.value, I am using: payload.value[7].value.value[2]

to read object 4 of msg.payload.value[7].value.value, I am using: payload.value[7].value.value[3]
Thanks again

To be pedantic that is an object with 4 key/value properties.
If it was an array debug would show it as [0,0,0,5]

I do not know whether or not this particular object can be regarded as an array (since the keys are "0" to "3") but it's probably best to treat it as an object, whatever it says in msg.payload.value[7].value.arrayType!

Yes that does suggest that this particular object can be treated as an array.

Sorry but 0005 is not an integer, it's a string. 5 is an integer.

I cannot offer any more help. I hope my offerings above lead you to the solution.