# Test if a tag is a folder?

**URL:** <https://forum.inductiveautomation.com/t/test-if-a-tag-is-a-folder/16083>\
**Category:** Module Development\
**Created:** [November 21, 2017, 9:44pm UTC](https://forum.inductiveautomation.com/t/test-if-a-tag-is-a-folder/16083 "2017-11-21T21:44:31Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [November 21, 2017, 9:44pm UTC](https://forum.inductiveautomation.com/t/test-if-a-tag-is-a-folder/16083/1 "2017-11-21T21:44:31Z")

</div>

I need to test if a tag is a folder :

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

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

`isFolder()` is Deprecated.,

```auto
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 🤔

---

<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:** [November 21, 2017, 9:49pm UTC](https://forum.inductiveautomation.com/t/test-if-a-tag-is-a-folder/16083/2 "2017-11-21T21:49:04Z")

</div>

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`.

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [November 21, 2017, 10:04pm UTC](https://forum.inductiveautomation.com/t/test-if-a-tag-is-a-folder/16083/3 "2017-11-21T22:04:09Z")

</div>

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

---

<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:** [November 21, 2017, 10:11pm UTC](https://forum.inductiveautomation.com/t/test-if-a-tag-is-a-folder/16083/4 "2017-11-21T22:11:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [November 21, 2017, 10:14pm UTC](https://forum.inductiveautomation.com/t/test-if-a-tag-is-a-folder/16083/5 "2017-11-21T22:14:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [March 5, 2021, 8:36am UTC](https://forum.inductiveautomation.com/t/test-if-a-tag-is-a-folder/16083/6 "2021-03-05T08:36:53Z")

</div>

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

---

<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:** [March 5, 2021, 1:35pm UTC](https://forum.inductiveautomation.com/t/test-if-a-tag-is-a-folder/16083/7 "2021-03-05T13:35:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [March 5, 2021, 8:12pm UTC](https://forum.inductiveautomation.com/t/test-if-a-tag-is-a-folder/16083/8 "2021-03-05T20:12:34Z")

</div>

> [@Kevin.Herron](#):
>
> `NodeDescription`

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

---

<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:** [March 5, 2021, 8:16pm UTC](https://forum.inductiveautomation.com/t/test-if-a-tag-is-a-folder/16083/9 "2021-03-05T20:16:05Z")

</div>

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

```auto
val descriptionPath: TagPath = tagPath.getChildPath(RuntimeTagProps.NodeDescription)

```
