Extract a value of an array

#1

I want to extract the value of a specific position in an array that I am receiving from Inject sent from a Raspberry Pi with the protocol OPC - UA as 'int' variable but I do not know how to do it in Node - RED

Node-RED message payload

12/04/2019, 16:47:43node: Pressure BMP180 Sensor
ns=2;i=4 : msg.payload : array[2]
array[2]
0: 0
1: 97448

12/04/2019, 16:12:22[node: Pressure BMP180 Sensor](http://10.6.4.101:1880/#)msg : string[15]

"Bad data inject"

The value i want is the 97454

My configuration in the Inject is:

image

I need the value of the 1: position in the array

0 Likes

#2

The docs have a page called "Working with messages"

https://nodered.org/docs/user-guide/messages

That has instructions on how to get at specific data you can display with a debug node.
Using that page and either a change node or a function node you should be able to do what you want to do.

0 Likes