# Can't write value to OPC-UA Integer Array

**URL:** <https://forum.inductiveautomation.com/t/cant-write-value-to-opc-ua-integer-array/69359>\
**Category:** Ignition\
**Tags:** ignition81, vision, scripting\
**Created:** [February 2, 2023, 6:37pm UTC](https://forum.inductiveautomation.com/t/cant-write-value-to-opc-ua-integer-array/69359 "2023-02-02T18:37:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lance\_Mills](https://avatars.discourse-cdn.com/v4/letter/l/8edcca/32.png) [@Lance\_Mills](https://forum.inductiveautomation.com/u/Lance_Mills)\
**Post date:** [February 2, 2023, 6:37pm UTC](https://forum.inductiveautomation.com/t/cant-write-value-to-opc-ua-integer-array/69359/1 "2023-02-02T18:37:24Z")

</div>

**Here is my version information and current settings:**

- Ignition Platform : 8.1.23
- OPC-UA Module 9.1.23
- Vision Modle 11.1.23
- OpcComModule 6.1.23
- Windows 10 Operating System
- TwinCat 3 PLC

**Ignition OPC Client Gateway Settings**

- Connected to OPC Server as authenticated user
- Client Connection Enabled
- Read only disabled

**UA Expert**  
I can read and write to integer arrays from UA Expert without issue. I wrote an 8 to Write\_Array[0] as a test and the write was successful.

**Similar thread with same issue**

> [@Can't write to array value](https://forum.inductiveautomation.com/t/cant-write-to-array-value/43704):
>
> This is for: Ignition 8.1.2 OPC UA module 9.1.2 Linux OPC UA connection to an Rx3i PLC I have an array variable called TestArray in my PLC that is defined as a DINT array of 200 elements (DINT in Rx3i speak is a double word integer). In the PLC, TestArray is set to publish on OPC as “External Read/Write”. EG An external source can write to it In a fresh install of 8.1.2, I created an OPC connection to the PLC, and in a new project I created an OPC tag pointing to the variable. Ignition re…

**My Issue**  
I want to write to a single bit in an integer array. The array I am using is published on the OPC server as "External Read/Write".

My HMI background is predominantly FactoryTalk, VTScada, DeltaV, etc. In those programs I'll usually setup an integer array that I can write both integer and bits for various functions and parameters such as push buttons, settings, etc.

I've recreated what I would normally do in Ignition, however I can't write any integer value to the specified array index. For example, I have Write\_Array[0] and trying to write anything returns the following:

> [Bad("Bad\_WriteNotSupported: The server not does support writing the combination of value.")]

**Attempt 1: Binding numeric text field to tag**  
I've tried multiple solutions. Binding the tag to the control or value property does not work. See below where I attempt to write a 2 to a numeric text field.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/7/c78852c517f5168c868a10de09bf86581eaf3c92.png)

**Attempt 2: Writing to tag using scripting**  
Next I applied the solution from the linked thread above with scripting. I have a template for a pushbutton with a custom property for a bit and word. Binding a property to a tag doesn't work. So I've hardcoded the array and index that I'm writing to.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/f/6f4062df1ee3215b8760f9877946e00c6e9ecb7c.png)

Here's the result after the clicking the button:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/2/32f3b284176ecd410b1863c3c3c6cafa460a3bb1.png)

**Conclusion**  
I've tested multiple solutions and I'm not sure what the issue could be. I can write to tags that are single booleans or integers no problem. For whatever reason I can't write to an array. Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 2, 2023, 6:40pm UTC](https://forum.inductiveautomation.com/t/cant-write-value-to-opc-ua-integer-array/69359/2 "2023-02-02T18:40:51Z")

</div>

This means the server does not support the IndexRange parameter of the OPC UA write service.

When you write with UaExpert what it's actually doing is writing the entire array with any modifications you made to it in the UI.

You'll have to build up the full array and do the same in Ignition, but this must be done from scripting. A write to the element always attempts to use the IndexRange parameter of the OPC UA Write service so that the write can be as atomic as possible when supported by the server.

---

<div class="post-metadata">

**Author:** ![Lance\_Mills](https://avatars.discourse-cdn.com/v4/letter/l/8edcca/32.png) [@Lance\_Mills](https://forum.inductiveautomation.com/u/Lance_Mills)\
**Post date:** [February 2, 2023, 7:08pm UTC](https://forum.inductiveautomation.com/t/cant-write-value-to-opc-ua-integer-array/69359/3 "2023-02-02T19:08:51Z")

</div>

Worked like a charm. Thank you.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/f/bf7183f3c4e77ac99dbdd6efb1b5b667d5eaa5e1.png)

Bit was set and cleared with no problem.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/d/ed3dda98d3c05d6cdad7a2d5cef4cd8fb8dbb085.png)
