Test if a tag is a folder?

I need to test if a tag is a folder :

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

According to SDK javadoc,
com.inductiveautomation.ignition.common.sqltags.model, Interface TagPath,

isFolder() is Deprecated.,

TagProp getProperty()

Returns the type of property in the tag that this path is referencing. If this path represents a folder, this will be null. If the path points just to a tag, this will return TagProp.Value (the default property)

But with a tag folder path, tagPath.getProperty() doesn’t return null (client and designer scope).
I missed something or there is another way to test if a TagPath is a folder or not :thinking:

The Javadoc on TagPath#isFolder() says that you must now get the actual item/tag pointed to by the path and check its type.

Tag#getType() returns a TagType enum, and you can check to see if it’s TagType.Folder.

Yes, but how can I obtain a Tag object from a TagPath object ?

Depends on the scope you’re in I guess. In the Gateway the TagManager from GatewayContext#getTagManager() has getTag(TagPath) on it.

I’m in the client scope, client context provide getTagManager too. Thanks a lot for your help :thumbsup:

with Ignition 8.1 getTag doesn’t exist anymore.
Is there another way to determine if a TagPath is a Folder ?

You would read the NodeDescription property and then check the TagObjectType returned by NodeDescription::getObjectType.

Only browseAsync seems to return NodeDescription, is there another way to read NodeDescription ?

Yeah, read it with readAsync. Append the NodeDescription property to your original TagPath:

val descriptionPath: TagPath = tagPath.getChildPath(RuntimeTagProps.NodeDescription)
1 Like