# Reading array of structs/UDTs from B&R PLC OPC-UA server

**URL:** <https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863>\
**Category:** Ignition\
**Created:** [June 22, 2020, 3:56am UTC](https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863 "2020-06-22T03:56:40Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 22, 2020, 3:56am UTC](https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863/1 "2020-06-22T03:56:40Z")

</div>

v7.9.14  
I think [this topic](http://forum.inductiveautomation.com/t/opc-ua-struct-data-type/26905/16) has the same issue, but just in case it isn’t, I didn’t want to hijack it.

I’m trying to read a tag from a B&R PC PLC’s OPC-UA server. The tag address is:  
`Group[0].Cmd.EnableLabelling`

Which I can partially get to from the OPC Browser:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/9/a9bb8364776e2dd348c3485c3158a6400171d938.png)

I’ve tried dragging on just the `Group` tag, which creates a StringArray tag with Unknown quality.  
I have no idea how to use `jsonGet` to pull out the rest of the tag? (solution from other topic)

---

<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:** [June 22, 2020, 1:16pm UTC](https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863/2 "2020-06-22T13:16:25Z")

</div>

If you just need this one tag then you can bring Group in as an OPC tag and then also make an expression tag with an expression like `jsonGet({path/to/group}, "[0].Cmd.EnableLabelling")`.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 22, 2020, 1:28pm UTC](https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863/3 "2020-06-22T13:28:07Z")

</div>

I just tried this, but the error on the expression tag is “Evaluation Error”. Not sure where to find more detailed info in the logs.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/7/e739f192330a68db387c5a34537681658c5ee3ce.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/2/5229ca1b796bfcf1ae09f7c9deb5a20c2cb72685.png)

---

<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:** [June 22, 2020, 1:29pm UTC](https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863/4 "2020-06-22T13:29:28Z")

</div>

Try changing the Group tag to String or Document instead of StringArray. It needs to have a valid value before this will work.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 22, 2020, 1:30pm UTC](https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863/5 "2020-06-22T13:30:51Z")

</div>

This is 7.9.14, I don’t see the Document data type ☹ I tried string, same thing: Group is Unknown quality

---

<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:** [June 22, 2020, 1:31pm UTC](https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863/6 "2020-06-22T13:31:35Z")

</div>

Can you pull in _any_ of the UDTs, array or scalar, from the controller as a String tag and get a good value?

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 22, 2020, 1:32pm UTC](https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863/7 "2020-06-22T13:32:34Z")

</div>

I just tried a bunch, and nope doesn’t look like it

---

<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:** [June 22, 2020, 1:33pm UTC](https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863/8 "2020-06-22T13:33:32Z")

</div>

Okay, so either the datatype dictionary isn’t being read properly or the server isn’t exposing one at all.

Can you turn DataTypeDictionaryReader to DEBUG and then edit/save the UA connection and send the logs to me?

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 22, 2020, 1:36pm UTC](https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863/9 "2020-06-22T13:36:31Z")

</div>

I have the logs, but can I just export the filtered results? otherwise it’s 250meg.  
Nvm it’s only 35 lines, i’ll copy paste to notepad

[B\_R\_OPCUA\_DataTypeDictionaryReader\_DEBUG.log](https://forum.inductiveautomation.com/uploads/short-url/2M0OoukdFFUZtUQVQpowDIUGMnT.log) (6.9 KB)

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 22, 2020, 1:46pm UTC](https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863/10 "2020-06-22T13:46:22Z")

</div>

From the Quick Client I see “The requested operation is not supported” when trying to read that Group struct:

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

---

<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:** [June 22, 2020, 1:47pm UTC](https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863/11 "2020-06-22T13:47:37Z")

</div>

Seems like something wrong with the server 😕

There’s only two small dictionaries in the logs you sent me and they don’t seem to contain any custom (user defined) structs.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 22, 2020, 1:50pm UTC](https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863/12 "2020-06-22T13:50:02Z")

</div>

Hmm, sounds like I’ll have to go back to B&R. Thanks for the help! I’ll update once I get a response and/or solution from them. Cheers

---

<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:** [June 22, 2020, 1:52pm UTC](https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863/13 "2020-06-22T13:52:43Z")

</div>

The Bad\_NotSupported is especially strange to me. Can you read them with UaExpert?

I sort of expected the problem here to be that the server was only supporting the UA 1.04 way of defining custom types but that doesn’t seem to be the issue.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 22, 2020, 2:02pm UTC](https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863/14 "2020-06-22T14:02:56Z")

</div>

I just tried in UA Expert and nope, can’t read it, same error `BadNotSupported` 😕

---

<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:** [June 22, 2020, 2:04pm UTC](https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863/15 "2020-06-22T14:04:40Z")

</div>

Well that’s good news for me at least 🙂

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 23, 2020, 2:12am UTC](https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863/16 "2020-06-23T02:12:13Z")

</div>

We ended up getting this working. There was an option within the B&R OPC-UA config where array elements needed to be enabled. I can now browse into the structs and read tags from within the structs directly.

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

There are also some integer array tags that weren’t working and now are, but I’d like to create individual tags for these. I’ve tried using the jsonGet (didn’t expect that to work), and using a derived tag with the expression `{source}[0,0]` but I get evaluation errors.

If I create a derived tag `Group Derived Tag` set the source tag to the integer array and leave the read expression default (e.g. `{source}`), then create an expression tag with the expression: `{[.]Group Derived Tag}[0,0]`. This works, I correctly read the first array element.  
However, I can’t create a second derived tag and use the expression: `{source}[0,0]`.

I haven’t used derived tags at all before…

---

<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:** [June 23, 2020, 11:37am UTC](https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863/17 "2020-06-23T11:37:54Z")

</div>

Is it a 2d array?

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 23, 2020, 11:50am UTC](https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863/18 "2020-06-23T11:50:05Z")

</div>

The integer array isn’t 2D. I tried `{source}[0]` as well, should have said that as well

---

<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:** [June 23, 2020, 3:54pm UTC](https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863/19 "2020-06-23T15:54:30Z")

</div>

Try an expression tag with `{[~]Int32Array[0]}`, `{[~]Int32Array[1]}`, etc… This works for me on Ignition 8, anyway.

`{[~]Int32Array}[0]` , `{[~]Int32Array}[1]` should work too, but there seems to be a problem with any index beyond 0, so we’ll look into that.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 23, 2020, 8:20pm UTC](https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863/20 "2020-06-23T20:20:04Z")

</div>

What if I need to be able to write back to the tag though? Don’t I need to use a derived tag? (in this instance I’m only reading, but thinking in the future)

[Next page](https://forum.inductiveautomation.com/t/reading-array-of-structs-udts-from-b-r-plc-opc-ua-server/35863.md?page=2)
