SDK 8.0 : determine if a path is a tag path or a folder path?

ignition80
#1

is there a way with the SDK 8.0 to determine if a path is a tag path or a folder path ?

tagPath = TagPathParser.parseSafe("default", fullTagPath);

returned tagPath has no information about tag or folder.

0 Likes

#2

You have to read the NodeDescription tag prop and then get the TagObjectType from it.

If you squint enough you can pretend this is Java:

    private suspend fun readTagObjectType(tagPath: TagPath): TagObjectType {
        val descriptionPath = tagPath.getChildPath(RuntimeTagProps.NodeDescription)

        val qv = tagManager.readAsync(listOf(descriptionPath)).await()[0]
        val nodeDescription = qv.value as? NodeDescription

        return nodeDescription?.objectType
            ?: throw UaException(StatusCodes.Bad_NodeIdUnknown)
    }
2 Likes