# Quality of document tag keeps changing

**URL:** <https://forum.inductiveautomation.com/t/quality-of-document-tag-keeps-changing/93871>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [July 29, 2024, 9:36pm UTC](https://forum.inductiveautomation.com/t/quality-of-document-tag-keeps-changing/93871 "2024-07-29T21:36:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![face\_plant](https://avatars.discourse-cdn.com/v4/letter/f/e495f1/32.png) [@face\_plant](https://forum.inductiveautomation.com/u/face_plant)\
**Post date:** [July 29, 2024, 9:36pm UTC](https://forum.inductiveautomation.com/t/quality-of-document-tag-keeps-changing/93871/1 "2024-07-29T21:36:29Z")

</div>

Hello! I have an array of structs that I am trying to render in a table in perspective. The tag's quality was `good` a couple of days ago, and now it is `bad` after a reboot of the PLC. Between reboots, none of the logic changed which is why this is puzzling.

```st
TYPE iLog : STRUCT
   level: WSTRING(256);
   msg: WSTRING(256);
   timestamp: UDINT;
END_STRUCT
END_TYPE

```

```st
_logs: ARRAY [0..99] OF iLog;

```

I am able to attach an OPC tag to the `_logs` array and view it within perspective. However, perspective says that the `value` is `bad` with the following error: `Bad("Bad_DecodingError: Decoding halted because of invalid data in the stream.")`. I also assigned the datatype of the tag as `Document`.

Heres a more detailed log of the error:

```plaintext
Message: Error writing to Quality.value: Error_TypeConversion("Cannot coerce value 'Bad("Bad_DecodingError: Decoding halted because of invalid data in the stream.")' into type: class com.inductiveautomation.ignition.common.model.values.QualityCod
Time: Mon Jul 29 1:58:48PM
Severity: ERROR
Logger: com.inductiveautomation.ignition.client.util.gui.ErrorUtil

```

Below is some info about the software I am using:

- codesys v3.5
- ignition edge 8.1.21
- perspective 2.1.21

Please let me know if I can provide anymore info. Thank you!

---

<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:** [July 29, 2024, 10:12pm UTC](https://forum.inductiveautomation.com/t/quality-of-document-tag-keeps-changing/93871/2 "2024-07-29T22:12:19Z")

</div>

The "more detailed log" seems to be from a write, so I'm not sure how these are related other than perhaps being for the same tag.

Are there any errors in the Ignition Gateway logs? Have you edit/saved that OPC UA connection? Did the structure definition change at all?

[Previously](https://forum.inductiveautomation.com/t/proper-type-to-write-to-document-tag/93263/9) we established that you'll need to upgrade in order to write to a structure array (document array).

---

<div class="post-metadata">

**Author:** ![face\_plant](https://avatars.discourse-cdn.com/v4/letter/f/e495f1/32.png) [@face\_plant](https://forum.inductiveautomation.com/u/face_plant)\
**Post date:** [July 30, 2024, 12:32am UTC](https://forum.inductiveautomation.com/t/quality-of-document-tag-keeps-changing/93871/3 "2024-07-30T00:32:36Z")

</div>

Oops! Didn't realize that detailed log was from a write attempt, please ignore it. I am only trying to read the document array.

**Are there any errors in the Ignition Gateway logs?**  
I set the `GatewayEventScriptNode` and `GatewayInterface` log levels to `TRACE` and then deleted the tag, added it back, and tried to read it via the script console

```python
print system.tag.readBlocking(["[edge]eventMgr/_logs"])

```

which gave me the error: `[[null, Bad("Bad_DecodingError: Decoding halted because of invalid data in the stream."), Mon Jul 29 17:01:14 EDT 2024 (1722286874248)]]`

Nothing appeared in the console (the logs) either but im not sure if I set the correct log level settings.

**Have you edit/saved that OPC UA connection?**  
I'm not completely sure what you mean by this, could you add more details? I've deleted, added, and refreshed the tag multiple times and still get this error. Is there something else I can try with the OPC UA connection?

**Did the structure definition change at all?**  
The structure didn't change either. I've tried other 'simpler' data types (ex: INT instead of ULINT) and still have the same error.

---

<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:** [July 30, 2024, 12:53am UTC](https://forum.inductiveautomation.com/t/quality-of-document-tag-keeps-changing/93871/4 "2024-07-30T00:53:18Z")

</div>

In the Gateway just edit and save the connection to that device. It forces a reconnect and the DataType information to be re-read.

---

<div class="post-metadata">

**Author:** ![face\_plant](https://avatars.discourse-cdn.com/v4/letter/f/e495f1/32.png) [@face\_plant](https://forum.inductiveautomation.com/u/face_plant)\
**Post date:** [July 30, 2024, 12:46pm UTC](https://forum.inductiveautomation.com/t/quality-of-document-tag-keeps-changing/93871/5 "2024-07-30T12:46:54Z")

</div>

These steps fixed it! Thank you!! What could've caused this and is there any way I can prevent it in the future?

---

<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:** [July 30, 2024, 12:59pm UTC](https://forum.inductiveautomation.com/t/quality-of-document-tag-keeps-changing/93871/6 "2024-07-30T12:59:58Z")

</div>

I'm not entirely sure why this worked. It suggests that maybe something about the datatype dictionary / definitions changed in the server, or when we reconnected the last time reading it failed.

---

<div class="post-metadata">

**Author:** ![face\_plant](https://avatars.discourse-cdn.com/v4/letter/f/e495f1/32.png) [@face\_plant](https://forum.inductiveautomation.com/u/face_plant)\
**Post date:** [July 30, 2024, 1:15pm UTC](https://forum.inductiveautomation.com/t/quality-of-document-tag-keeps-changing/93871/7 "2024-07-30T13:15:18Z")

</div>

okay I see. If I run into this issue again then I can use your solution which is good enough. Thanks again!!! Spent too long trying to figure this out
