# Bad\_Decoding Error when reading Siemens Array of Date\_And\_Time from inside a PLC UDT via OPC

**URL:** <https://forum.inductiveautomation.com/t/bad-decoding-error-when-reading-siemens-array-of-date-and-time-from-inside-a-plc-udt-via-opc/97821>\
**Category:** Ignition\
**Tags:** opcua, ignition81, perspective\
**Created:** [October 28, 2024, 7:54am UTC](https://forum.inductiveautomation.com/t/bad-decoding-error-when-reading-siemens-array-of-date-and-time-from-inside-a-plc-udt-via-opc/97821 "2024-10-28T07:54:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Majewski](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@Alex\_Majewski](https://forum.inductiveautomation.com/u/Alex_Majewski)\
**Post date:** [October 28, 2024, 7:54am UTC](https://forum.inductiveautomation.com/t/bad-decoding-error-when-reading-siemens-array-of-date-and-time-from-inside-a-plc-udt-via-opc/97821/1 "2024-10-28T07:54:26Z")

</div>

I seem to be having an issue reading an object of type "Array[0..1] of Date\_And\_Time" from a Siemens PLC when it exists inside a Siemens UDT. In Ignition I am using the entire UDT as an OPC tag, and then using derived tags to reference the individual internal tags (which aren't shown below).

 ![Failing_Tags](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/6/a6fe6c24597a28b789e1da2134e8233ddc71ec56.png)

I've done some testing and Ignition can happily read an array of Date\_And\_Time when its on its own, however, when the array exists inside a UDT, it fails with the error:  
Bad("Bad\_DecodingError: Decoding halted because of invalid data in the stream.")

 ![Screenshot 2024-10-28 154943](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/1/711aaaeb43f201de880492820eff7127a7eec79f.png)

Other array types work fine when inside a UDT, it just seems to be when its of type Date\_And\_Time.  
I am using a Siemens 1500 PLC and connecting to the OPC Server on the PLC

---

<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:** [October 30, 2024, 2:44pm UTC](https://forum.inductiveautomation.com/t/bad-decoding-error-when-reading-siemens-array-of-date-and-time-from-inside-a-plc-udt-via-opc/97821/2 "2024-10-30T14:44:52Z")

</div>

I just left a note on your support ticket so I suspect you'll be hearing from them soon, but the problem here is:

- Siemens OPC UA server models Date\_And\_Time as an unsigned byte array. It's not the type they want you to use when accessing over OPC UA.
- The legacy datatype dictionary mechanism does not support defining structures with multi-dimensional array members.
- When you define a "Date\_And\_Time array" what you've really ended up defining at the OPC UA structure definition is a 2-dimensional unsigned byte array.
- This causes the structure to be omitted from the datatype dictionary and unreadable by Ignition.

You should be using the LDT datatype for datetime values that you will access over OPC UA.
