# How do I declare an array element in OpcUa-Item node

**URL:** <https://discourse.nodered.org/t/how-do-i-declare-an-array-element-in-opcua-item-node/97209>\
**Category:** General\
**Tags:** opcua, array-of-an-object\
**Created:** [22 May 2025 13:15 UTC](https://discourse.nodered.org/t/how-do-i-declare-an-array-element-in-opcua-item-node/97209 "2025-05-22T13:15:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kapparice](https://avatars.discourse-cdn.com/v4/letter/k/65b543/32.png) [@kapparice](https://discourse.nodered.org/u/kapparice)\
**Post date:** [22 May 2025 13:15 UTC](https://discourse.nodered.org/t/how-do-i-declare-an-array-element-in-opcua-item-node/97209/1 "2025-05-22T13:15:27Z")

</div>

Hi All,

I am new to node-red and I am developing a simulation environment for a PLC using OPC-UA. I added some values to the OPCUA server in the PLC, and tested them in UAExpert Client:  
One of them is a boolean, to enable the simulation  
Other are boolean arrays of elements, for the simulated inputs and outputs  
The problem comes in the web environment, when I try to simulate a fault in the system by toggling an element on the array (I have tried the Boolean and it works fine).

In OpcUa-Item node, I added:

_For the Simulation boolean:_  
Item: "ns=4;s=Root.SimulationON"  
Type: "Boolean"  
Name: "SimON"

_For the Fault bit into the Array_  
Item: "ns=4;s=Root.DIArraySim[17]"  
Type: "Boolean"  
Name: "109U01\_Fault"

After Deploying , I flicked the a switch and only the simulation boolean works, but the element in the array cannot be found. It shows _error The node id refers to a node that does not exist in the server address space_

I could not find any reference to this in any forum. I have been trying different things but nothing worked. Perhaps I am missing something simple.

I attach the nodes so you can have a look.

```auto
[
    {
        "id": "54b85cea1233730f",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "921f7afec8789911",
        "type": "OpcUa-Item",
        "z": "54b85cea1233730f",
        "item": "ns=4;s=Root.SimulationON",
        "datatype": "Boolean",
        "value": "",
        "name": "SimON",
        "x": 560,
        "y": 200,
        "wires": [
            [
                "e3c148c343a44193"
            ]
        ]
    },
    {
        "id": "d6bf2d5d03473384",
        "type": "OpcUa-Item",
        "z": "54b85cea1233730f",
        "item": "ns=4;s=Root.DIArraySim[17]",
        "datatype": "Boolean",
        "value": "",
        "name": "109U01_Fault",
        "x": 580,
        "y": 260,
        "wires": [
            [
                "e3c148c343a44193"
            ]
        ]
    },
    {
        "id": "e3c148c343a44193",
        "type": "OpcUa-Client",
        "z": "54b85cea1233730f",
        "endpoint": "e49ccceb2c1debc5",
        "action": "write",
        "deadbandtype": "a",
        "deadbandvalue": 1,
        "time": "1",
        "timeUnit": "s",
        "certificate": "n",
        "localfile": "",
        "localkeyfile": "",
        "securitymode": "None",
        "securitypolicy": "None",
        "useTransport": false,
        "maxChunkCount": "",
        "maxMessageSize": "",
        "receiveBufferSize": "",
        "sendBufferSize": "",
        "setstatusandtime": false,
        "keepsessionalive": false,
        "name": "OPCUA_WRITE",
        "x": 800,
        "y": 200,
        "wires": [
            [],
            [],
            []
        ]
    },
    {
        "id": "5dc7af7298669d90",
        "type": "ui_switch",
        "z": "54b85cea1233730f",
        "name": "",
        "label": "SimulationON",
        "tooltip": "",
        "group": "212183c70d99713f",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": false,
        "decouple": "false",
        "topic": "topic",
        "topicType": "msg",
        "style": "",
        "onvalue": "true",
        "onvalueType": "bool",
        "onicon": "",
        "oncolor": "",
        "offvalue": "false",
        "offvalueType": "bool",
        "officon": "",
        "offcolor": "",
        "animate": false,
        "className": "",
        "x": 360,
        "y": 200,
        "wires": [
            [
                "921f7afec8789911"
            ]
        ]
    },
    {
        "id": "92bf8898f2056fbc",
        "type": "ui_switch",
        "z": "54b85cea1233730f",
        "name": "",
        "label": "109U01_Fault",
        "tooltip": "",
        "group": "212183c70d99713f",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": true,
        "decouple": "false",
        "topic": "topic",
        "topicType": "msg",
        "style": "",
        "onvalue": "true",
        "onvalueType": "bool",
        "onicon": "",
        "oncolor": "",
        "offvalue": "false",
        "offvalueType": "bool",
        "officon": "",
        "offcolor": "",
        "animate": false,
        "className": "",
        "x": 360,
        "y": 260,
        "wires": [
            [
                "d6bf2d5d03473384"
            ]
        ]
    },
    {
        "id": "e49ccceb2c1debc5",
        "type": "OpcUa-Endpoint",
        "endpoint": "opc.tcp://192.168.147.4:48020",
        "secpol": "None",
        "secmode": "None",
        "none": true,
        "login": false,
        "usercert": false,
        "usercertificate": "",
        "userprivatekey": ""
    },
    {
        "id": "212183c70d99713f",
        "type": "ui_group",
        "name": "DevBox01",
        "tab": "2d0adb55be7122fc",
        "order": 1,
        "disp": true,
        "width": 6,
        "collapse": false,
        "className": ""
    },
    {
        "id": "2d0adb55be7122fc",
        "type": "ui_tab",
        "name": "Profelis",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

```

Kind regards

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [20 August 2025 13:16 UTC](https://discourse.nodered.org/t/how-do-i-declare-an-array-element-in-opcua-item-node/97209/2 "2025-08-20T13:16:05Z")

</div>

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