[IGN-668] How can I get a tag datatype off OPC server?

We’re trying to setup a project where we can browse and add an OPC tag to a UDT. We’ve got the browse setup so I can drill down in the tree and select a specific tag on our OPC server. I can get the OPC Path from the browse but I can’t see a way to get the datatype off the tag. Since we can drag and drop opc tags into the tag browser full configured, I assume there’s a way to find the datatype. Can someone point me in the right direction?

thank you in advance!

Which system.opc browse function are you using?

If you’re using system.tag.browse, you can read the UDTParentType property of the tag. Eg
path/to/tag.UDTParentType

Unless the IA guys have a simpler solution?

We use system.opc.browseServer to populate the navigation tree.

There was another thread about this and an open ticket on our side, but this function doesn’t return any datatype information.

The big thing stopping it from being implemented is that returning a Class<?> from a getDataType() is the most natural fit, but some of the classes returned are OPC UA types that don’t exist in the client/designer code, and since this function can be called from any scope, can’t be serialized and returned to clients.

We might be able to return different results depending on whether it was called from client or gateway scope but that’s a little awkward to document and use.

is there another function I can use then? I’m using system.opc.browseServer to get the tag path for a system.tag.configure script I’m using to create new tags based on a UDT. I’m basically just looking to grab specific info to populate the JSON information I need to create the tags in Ignition.

This one has datatype info, but it’s not a drop in replacement for browseServer: https://docs.inductiveautomation.com/display/DOC80/system.opc.browse

The problem is I think this one is always a recursive browse…

I think I’m not clear on the syntax on this function. Is it possible to use it to “browse” straight to a specific tag with system.opc.browse? however I write it, it always times out.

Yeah, probably because it stupidly does a full recursive browse, which almost always times out if you have anything but a small system…

I think you’re just going to have to wait until we can add datatype information to the browseServer call.

Is that an imminent addition or a “one of these days” feature?

It looks easy, I’m going to add it to our board for the next sprint. Someone else was asking about this a couple weeks ago too.

2 Likes

That would be appreciated. Thanks for your assistance!

This was implemented in Ignition 8.1.1.

https://docs.inductiveautomation.com/display/DOC81/system.opc.browseServer

Sweet. Mucho gracias!