# Siemens, OPC UA Write in Array of Data type

**URL:** <https://forum.inductiveautomation.com/t/siemens-opc-ua-write-in-array-of-data-type/69612>\
**Category:** General Discussion\
**Created:** [February 9, 2023, 9:21am UTC](https://forum.inductiveautomation.com/t/siemens-opc-ua-write-in-array-of-data-type/69612 "2023-02-09T09:21:48Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaximePuntis](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@MaximePuntis](https://forum.inductiveautomation.com/u/MaximePuntis)\
**Post date:** [February 9, 2023, 9:21am UTC](https://forum.inductiveautomation.com/t/siemens-opc-ua-write-in-array-of-data-type/69612/1 "2023-02-09T09:21:48Z")

</div>

Hi,

Configuration : PLC Siemens 1500, OPC UA communication .

I love the possibilities of the native OPC UA in the siemens and ignition. But when a great tool, we always try to do more and I came across a problem: I can't write in an array of data type. I have the following error : "Bad\_EncodingError: Encoding halted because of invalid data in the objects being serialized."

To explain, nothing better than a few images:

Data type declaration

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

Data type array instance

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

Creation of the variable in Ignition with the assistant that goes well

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

We change the type to document to manage the json.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/0/306e32f32f440b0fd2b529e3b6be3ac7b546bab4.png)

We display the value in a text area, without forgetting the Bi-directional option.  
Nickel, we read the right values.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/5/95603cf0af9a3cf46622fb0fcd2c2d8961a35586.png)

But as soon as we want to modify the value, the error appears.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/3/033838103b9e1f4c2b54655fec49f565b686f541.png)

If I link the tag with an array member, no worries.

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

I can read and write with no problem.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/6/a6826e05de596a980f9ac7db7b4891f93fd886f4.png)

I looked in the traces on the gateway and I get the following detail:

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

I couldn't find the documentation for "org.eclipse.milo.opcua.stack.core.UaSerializationException", nor any information about the "unknown builtin type: -1" fault.  
Any ideas ? Thanks in advance !!

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [February 9, 2023, 12:20pm UTC](https://forum.inductiveautomation.com/t/siemens-opc-ua-write-in-array-of-data-type/69612/2 "2023-02-09T12:20:28Z")

</div>

Note sure write is supported for such if data type. Probably @Kevin.Herron can answer

---

<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 9, 2023, 3:57pm UTC](https://forum.inductiveautomation.com/t/siemens-opc-ua-write-in-array-of-data-type/69612/3 "2023-02-09T15:57:16Z")

</div>

What version of Ignition is this?

---

<div class="post-metadata">

**Author:** ![MaximePuntis](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@MaximePuntis](https://forum.inductiveautomation.com/u/MaximePuntis)\
**Post date:** [February 9, 2023, 4:33pm UTC](https://forum.inductiveautomation.com/t/siemens-opc-ua-write-in-array-of-data-type/69612/4 "2023-02-09T16:33:00Z")

</div>

I thought the last one but you work faster than me!! It's 8.1.23. I can test with 8.1.24 if needed.

---

<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 9, 2023, 4:34pm UTC](https://forum.inductiveautomation.com/t/siemens-opc-ua-write-in-array-of-data-type/69612/5 "2023-02-09T16:34:01Z")

</div>

No, it's fine, it looks like it doesn't work in the latest code either.

I'm just trying to figure out if this is a regression or it never worked at all.

---

<div class="post-metadata">

**Author:** ![MaximePuntis](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@MaximePuntis](https://forum.inductiveautomation.com/u/MaximePuntis)\
**Post date:** [February 10, 2023, 8:45am UTC](https://forum.inductiveautomation.com/t/siemens-opc-ua-write-in-array-of-data-type/69612/6 "2023-02-10T08:45:07Z")

</div>

Thanks for taking the time to look. If it works it will allow me to compensate that currently it is not possible to create an array of UDTs in another UDT : [array-of-udt-inside-another-udt](https://forum.inductiveautomation.com/t/array-of-udt-inside-another-udt/57754/4)

In the parent UDT I have to recreate a child UDT per instance but everyone uses the same source with the PLC.

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

PLC configuration :  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/8/a82f90c6b3274adfdf275b6f2de8f9140387cd36.png)

It works fine for reading but not for writing.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/8/48c43e8c21383294b4e4701d58223b3cc8f32ec0.png)

Otherwise I would have to create one source tag per child but that multiplies the number of communications by the same amount!!!

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

Especially since I keep the source tag of the parent because it's much faster to loop in the Json of it than to do a "system.tag.readBlocking()" on the parent tag. The time ranges from a few milliseconds to several seconds.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 10, 2023, 12:44pm UTC](https://forum.inductiveautomation.com/t/siemens-opc-ua-write-in-array-of-data-type/69612/7 "2023-02-10T12:44:50Z")

</div>

It seems you have not parameterized your inner UDT in sufficient detail and uniqueness to implement this correctly. Share your UDT json if you want more focused advice from the crowd here on the forum.

---

<div class="post-metadata">

**Author:** ![MaximePuntis](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@MaximePuntis](https://forum.inductiveautomation.com/u/MaximePuntis)\
**Post date:** [February 10, 2023, 1:29pm UTC](https://forum.inductiveautomation.com/t/siemens-opc-ua-write-in-array-of-data-type/69612/9 "2023-02-10T13:29:25Z")

</div>

Excuse me pturnel for confusing you with the "array of udt inside another udt" part (my previous post) and the explanations that go with it.  
I have no problem with this part. This was just to explain the purpose and use of my first question.

---

<div class="post-metadata">

**Author:** ![MaximePuntis](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@MaximePuntis](https://forum.inductiveautomation.com/u/MaximePuntis)\
**Post date:** [May 10, 2023, 9:58am UTC](https://forum.inductiveautomation.com/t/siemens-opc-ua-write-in-array-of-data-type/69612/10 "2023-05-10T09:58:13Z")

</div>

Thank you @Kevin.Herron for considering my issue and faster!!!!  
This is fixed in version 8.1.27 : [First Bite: OPC UA Writes](https://inductiveautomation.com/blog/ignition-8127-opc-ua-writes-oidc-request-options-designer-gateway-configuration-properties?utm_medium=email&utm_source=marketo-newsfeed-text&utm_campaign=2023-04-27-ignition-8.1.27&utm_content=product-updates&mkt_tok=OTY2LVRVWC0yNjEAAAGLYcXsUKepmK1vS7fnMxcWz-3kWEdV0mmyEj-4Jnfbdcmu_BG1zEASSOfxrK5W4f8BdGvi7jxxIcK9ahTmHDFpsGgUIo71qR9LftmXYQUFfq-nug)
